Skip to content

Commit 1f18797

Browse files
committed
build: add install/uninstall targets and update README
1 parent 3a7e9ba commit 1f18797

4 files changed

Lines changed: 77 additions & 27 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ cpuMonitorNote.txt
33
dubuggerGuide.txt
44
processMonitorNote.txt
55
project_flowChart.txt
6+
NOTES.md
67

78
# Build files
89
*.o

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,10 @@ add_executable(test_all tests/test_all.cpp ${TEST_SRC})
2323
target_include_directories(test_all PRIVATE include)
2424
target_link_libraries(test_all GTest::GTest GTest::Main ncursesw tinfo pthread)
2525

26-
# ── Install ───────────────────────────────────────────────────────────
27-
install(TARGETS sysmon DESTINATION /usr/local/bin)
26+
# ── Install / Uninstall ───────────────────────────────────────────────────────────
27+
install(TARGETS sysmon DESTINATION /usr/local/bin)
28+
29+
add_custom_target(uninstall
30+
COMMAND ${CMAKE_COMMAND} -E remove /usr/local/bin/sysmon
31+
COMMENT "Uninstalling sysmon..."
32+
)

README.md

Lines changed: 66 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ A lightweight, real-time Linux system monitor written in **modern C++17** — re
1010

1111
---
1212
![demo](https://github.com/user-attachments/assets/5478a0c6-1843-4cf4-b846-2fd02d8b3707)
13+
14+
---
15+
> ⭐ If you found this useful, consider starring the repo
1316
---
1417

1518
## Overview
@@ -124,47 +127,91 @@ sysmon/
124127
```
125128

126129
---
130+
# Installation Guide
127131

128-
## Build & Run
132+
## Prerequisites
129133

130-
### Requirements
131-
- Linux (kernel 2.6+)
132-
- g++ with C++17 support
133-
- ncurses (`libncurses-dev`)
134+
Make sure you have the following installed:
134135

135-
### Install ncurses
136+
### Ubuntu/Debian
137+
```bash
138+
sudo apt install build-essential cmake libncurses-dev
139+
```
136140

141+
### Arch Linux
137142
```bash
138-
# Debian/Ubuntu
139-
sudo apt install libncurses-dev
143+
sudo pacman -S base-devel cmake ncurses
144+
```
140145

141-
# Arch
142-
sudo pacman -S ncurses
146+
### Fedora
147+
```bash
148+
sudo dnf install gcc-c++ cmake ncurses-devel
143149
```
144150

145-
### Build & Run
151+
---
146152

153+
## Install
147154
```bash
148-
git clone https://github.com/riteshdhurwey/SysMon.git
149-
cd SysMon
155+
# Clone the repository
156+
git clone https://github.com/yourusername/sysmon.git
157+
cd sysmon
158+
159+
# Build
150160
mkdir build
151-
cd build
161+
cd build
152162
cmake ..
153163
make
154164

155-
./sysmon
156-
157-
make clean
165+
# Install
166+
sudo make install sysmon
158167
```
159168

160-
### Run Tests
169+
---
161170

171+
## Uninstall
172+
```bash
173+
cd build
174+
sudo make uninstall
162175
```
163-
make && ./test_all
176+
177+
---
178+
179+
## Usage
180+
```bash
181+
sysmon
164182
```
165183

166184
---
167185

186+
## Running Tests
187+
188+
### Install Google Test
189+
190+
#### Ubuntu/Debian
191+
```bash
192+
sudo apt install libgtest-dev
193+
```
194+
195+
#### Arch Linux
196+
```bash
197+
sudo pacman -S gtest
198+
```
199+
200+
#### Fedora
201+
```bash
202+
sudo dnf install gtest-devel
203+
```
204+
205+
### Run Tests
206+
```bash
207+
cd build
208+
make test
209+
210+
./test_all
211+
```
212+
213+
> **Note:** `sudo` is required for install/uninstall as it copies binary to `/usr/local/bin`
214+
168215
## /proc Files Used
169216

170217
| File | Purpose |
@@ -219,13 +266,7 @@ make && ./test_all
219266
- [ ] Metric logging to CSV
220267
- [ ] Bug fixes and performance improvements
221268

222-
---
223269

224-
---
225-
226-
> If you found SysMon useful, consider giving it a ⭐ — it helps others discover the project!
227-
228-
---
229270

230271
## Contributing
231272

src/ui.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,12 @@ void UI::drawProcessList(const std::vector<Process>& procs) {
260260
mvwhline(procWin, y, 1, ' ', termCols - 2); // clear line first
261261

262262
if (sel) wattron(procWin, A_REVERSE | A_BOLD);
263+
263264
char cpuStr[16];
264265
snprintf(cpuStr, sizeof(cpuStr), "%.1f%%", p.cpuPercent);
266+
265267
std::string timeStr = sysinfo.format_ps_time(p.runtime);
268+
266269
mvwprintw(procWin, y, 2, "%-7d %-16s %-9s %-10s %-15s %ld",
267270
p.pid, p.name.c_str(), cpuStr,
268271
p.state.c_str(),timeStr.c_str(), p.memoryKB / 1024);

0 commit comments

Comments
 (0)