Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/native_full_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build ProcessMonitor in Native Environment

on:
pull_request:
branches: [ main ]
paths: ['**/*.c', '**/*.cpp', '**/*.cc', '**/*.cxx', '**/*.h', '**/*.hpp', '**/*.sh', '**/CMakeLists.txt']

jobs:
build-processmonitor-on-pr:
name: Build ProcessMonitor component
runs-on: ubuntu-latest
container:
image: ghcr.io/rdkcentral/docker-device-mgt-service-test/native-platform:1.6.9

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Dependencies
run: |
apt-get update
apt-get install -y cmake build-essential

- name: Create build directory
run: |
mkdir -p build
cd build

- name: Configure with CMake
run: |
cd build
cmake -DCMAKE_BUILD_TYPE=Release ../

- name: Build the component
run: |
cd build
make -j$(nproc)

- name: Verify build output
run: |
ls -la build/ProcessMonitor || echo "ProcessMonitor binary not found"
ls -la build/libexithandler.so* || echo "exitHandler library not found"
file build/ProcessMonitor || echo "Cannot check ProcessMonitor file type"
file build/libexithandler.so* || echo "Cannot check exitHandler file type"
echo "Build verification complete"

14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ target_link_libraries(${PROJECT_NAME}
Threads::Threads
)

add_library(exitHandler SHARED exitHandler.c)

target_link_libraries(exitHandler Threads::Threads)

set_target_properties(exitHandler PROPERTIES
OUTPUT_NAME exithandler
VERSION 1.0.0
SOVERSION 1)

install(TARGETS exitHandler
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)
)
8 changes: 8 additions & 0 deletions Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <regex>
#include <string>
#include <vector>
#include <optional>

/**
* Often commands will be prefixed with the interpreter to use (e.g. /bin/sh -c echo "hello world"). Strip
Expand Down Expand Up @@ -35,6 +36,13 @@ struct processInfo

std::string systemdServiceName;

// Memory statistics (optional, populated when --mem is used)
std::optional<unsigned long> pss; // Proportional Set Size (KB)
std::optional<unsigned long> swapPss; // Swap PSS (KB)
std::optional<unsigned long> rss; // Resident Set Size (KB)
std::optional<unsigned long> utime; // User CPU time (jiffies)
std::optional<unsigned long> stime; // System CPU time (jiffies)

/**
* Use some heuristics to try and get a suitable name for the timeline group
*
Expand Down
Loading