Skip to content
Merged
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
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<img src="./docs/images/app_icon.png" alt="taskmgr-cli icon" height="40" align="left" />
Task Monitor
</h1>
<p>A modern, powerful cross-platform terminal-based task monitor designed to provide real-time monitoring and management of a computer's performance, active processes, and resource utilization.
Originally inspired by tools like <b>top</b>, <b>htop</b> and the <b>Windows Task Manager</b>, it provides performance monitoring at-a-glance for system resources (including CPU, GPU, Memory, Swap, Disk and Network) and process
management functions.</p>
<p>A modern, powerful cross-platform terminal-based task monitor providing real-time monitoring and management of a computer's performance, active processes, and resource utilization. Perfect for Homelab and local LLM monitoring.
Originally inspired by tools like <b>top</b>, <b>htop</b> and the <b>Windows Task Manager</b>, it provides performance monitoring at-a-glance for system resources (including CPU, GPU, Memory, Swap, Disk and Network) and process management functions.</p>

[![Homebrew](https://img.shields.io/badge/homebrew-orange?style=flat-square&logo=homebrew&logoColor=white)](#macos-on-apple-silicon)
[![Chocolatey](https://img.shields.io/badge/chocolatey-blue?style=flat-square&logo=chocolatey&logoColor=white)](#windows-on-x64-and-arm64)
Expand All @@ -18,8 +17,9 @@ management functions.</p>

## Features

- **No sudo or administrator privilege required** - Native platform APIs used on each platform.
- Written in C# using platform native interop for maximum performance and minimum memory overhead.
- **Perfect for HomeLab and Local LLM monitoring**
- **No sudo or administrator privilege required**
- **Cross-Platform native performance**: Written in C# using platform native interop for maximum performance and minimum memory overhead (zero third-party dependencies)
- **Real-Time System Monitoring**: Live updates of CPU, GPU, memory, swap, disk I/O and Network I/O.
- High resolution charts in 24-bit colour.
- Switch layouts (`F8`) to focus charts on specific system metrics.
Expand All @@ -46,9 +46,9 @@ management functions.</p>
- **System profile**: Display machine name, OS name and version, CPU name and clock speed, top resource consumers (Avg and Max) (using the `F9` function).

**Cross-Platform Native Performance**
- Platform-specific optimizations using native APIs (Win32, Mach kernel).
- .net native with small memory footprint.
- No dependencies on libraries such as ncurses.
- Platform-specific optimizations using C APIs (Win32, Mach kernel).
- .net native build with small memory footprint.
- Zero third-party dependencies on libraries such as ncurses.

## Installation

Expand Down Expand Up @@ -111,6 +111,8 @@ Task Monitor supports the following commands on startup. Note these commands can
| Command | What it does |
|---------|--------------|
| `taskmon` | Start Task Monitor with configuration defaults. |
| `taskmon --gpu-only` | Automatically monitor GPU resources on startup. |
| `taskmon --cpu-only` | Automatically monitor CPU resources on startup. |
| `taskmon --pid <pid>` | Automatically monitor the pid nnn on startup. |
| `taskmon --username <username>` | Automatically monitor all processes running under user <username> on startup. |
| `taskmon --process <processname>` | Automatically monitor all processes with matching <processname> on startup. |
Expand Down Expand Up @@ -147,8 +149,8 @@ Task Monitor stores configuration and log files in the following system director

### Windows

| Config | Path | Description |
|--------|------|-------------|
| Config | Path |
|--------|------|
| `taskmon.ini` | `~\AppData\Roaming\taskmon` |
| Theme files | `~\AppData\Roaming\taskmon\themes` |
| Layout files | `~\AppData\Roaming\taskmon\layouts` |
Expand Down
2 changes: 2 additions & 0 deletions src/taskmon/Actions/ShowUsageAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public int Run()
Usage: {Constants.AppName} [options]

Options:
--gpu-only Show Gpu Charts and sort process list by Gpu% on startup
--cpu-only Show Cpu Charts and sort process list by Cpu% on startup
--pid PID Monitor the given process PID
-u --username <NAME> Only show processes for the the given user NAME
-p --process <NAME> Only show processes with matching process NAME
Expand Down
2 changes: 1 addition & 1 deletion src/taskmon/Assets/Themes/Alien Blood.theme
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ background=#0f1610
background-highlight=#1d4125

col-cmd-normal-user-space=#327f77
col-cmd-low-priority=#121d18
col-cmd-low-priority=#10b981
col-cmd-high-cpu=#b082d1
col-cmd-io-bound=#dff0e6
col-cmd-script=#dff0e6
Expand Down
2 changes: 2 additions & 0 deletions src/taskmon/Configuration/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public sealed class Sections
public const string ThemeMsDos = "MS-DOS";

public const string LayoutAllCharts = "All Charts";
public const string LayoutGpuAndGpuMemoryLarge = "Gpu And Gpu Memory Large";
public const string LayoutCpuAndMemoryLarge = "Cpu And Memory Large";
}

public sealed class Keys
Expand Down
10 changes: 5 additions & 5 deletions src/taskmon/Gui/Controls/ProcessControl.Columns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ public partial class ProcessControl
internal const int ColumnProcessWidth = 32;
internal const int ColumnPidWidth = 7;
internal const int ColumnUserWidth = 16;
internal const int ColumnPriorityWidth = 4;
internal const int ColumnPriorityWidth = 5;
internal const int ColumnCpuWidth = 7;
internal const int ColumnAvgCpuWidth = 9;
internal const int ColumnMaxCpuWidth = 9;
internal const int ColumnAvgCpuWidth = 10;
internal const int ColumnMaxCpuWidth = 10;
internal const int ColumnThreadsWidth = 7;
internal const int ColumnGpuWidth = 7;
internal const int ColumnAvgGpuWidth = 9;
internal const int ColumnMaxGpuWidth = 9;
internal const int ColumnAvgGpuWidth = 10;
internal const int ColumnMaxGpuWidth = 10;
internal const int ColumnMemoryWidth = 10;
internal const int ColumnAvgMemoryWidth = 10;
internal const int ColumnMaxMemoryWidth = 10;
Expand Down
21 changes: 21 additions & 0 deletions src/taskmon/TaskMonApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@ internal bool ProcessArgs(string[] args, out List<IAction> actions)
}
}

bool isGpuOnly = args.Contains("--gpu-only");
bool isCpuOnly = !isGpuOnly && args.Contains("--cpu-only");

if (isGpuOnly || isCpuOnly) {
var (layoutName, sortCol) = isGpuOnly
? (Constants.Sections.LayoutGpuAndGpuMemoryLarge, Statistics.Gpu)
: (Constants.Sections.LayoutCpuAndMemoryLarge, Statistics.Cpu);

Layout? defaultLayout = runContext.AppConfig.Layouts.FirstOrDefault(l =>
l.Name.Equals(layoutName, StringComparison.CurrentCultureIgnoreCase));

if (defaultLayout != null) {
runContext.AppConfig.DefaultLayout = defaultLayout;
runContext.AppConfig.SortColumn = sortCol;
}
else {
OutputWriter.Error.WriteLine($"{Constants.AppName}: Layout {layoutName} not found");
result = false;
}
}

if (!result || args.Any(arg => arg == "-h" || arg == "--help")) {
actions.Add(new ShowUsageAction());
return result;
Expand Down
3 changes: 0 additions & 3 deletions tests/Task.Monitor.Tests/TaskMonAppTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ public static TheoryData<string, string, string> InvalidArgData()
{ "--delay", "-1500", $"{Constants.AppName}: bad delay arg: -1500" },
{ "--limit", "1oo", $"{Constants.AppName}: bad limit arg: 1oo" },
{ "--limit", "-10", $"{Constants.AppName}: bad limit arg: -10" },
{ "--delay", "!#@$%^#$@", $"{Constants.AppName}: bad delay arg: !#@$%^#$@" },
{ "--delay", "200", $"{Constants.AppName}: bad delay arg: 200" },
{ "--delay", "-1500", $"{Constants.AppName}: bad delay arg: -1500" },
{ "--nprocs", "4g77h", $"{Constants.AppName}: bad nprocs arg: 4g77h" },
{ "--nprocs", "0", $"{Constants.AppName}: bad nprocs arg: 0" },
{ "--nprocs", "-12", $"{Constants.AppName}: bad nprocs arg: -12" },
Expand Down
Loading