SiddiqSoft.WinProcessInfo 2.5.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package SiddiqSoft.WinProcessInfo --version 2.5.3
                    
NuGet\Install-Package SiddiqSoft.WinProcessInfo -Version 2.5.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SiddiqSoft.WinProcessInfo" Version="2.5.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SiddiqSoft.WinProcessInfo" Version="2.5.3" />
                    
Directory.Packages.props
<PackageReference Include="SiddiqSoft.WinProcessInfo" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SiddiqSoft.WinProcessInfo --version 2.5.3
                    
#r "nuget: SiddiqSoft.WinProcessInfo, 2.5.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SiddiqSoft.WinProcessInfo@2.5.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SiddiqSoft.WinProcessInfo&version=2.5.3
                    
Install as a Cake Addin
#tool nuget:?package=SiddiqSoft.WinProcessInfo&version=2.5.3
                    
Install as a Cake Tool

ProcessInfo : Cross-Platform Process Information

CodeQL Build Status alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Overview

A header-only C++23 library providing cross-platform process information with minimal footprint. Captures CPU, memory, and system details for the current process.

Features:

  • Minimal footprint - header-only library
  • Cross-platform support (Windows, Linux, macOS, Unix)
  • JSON serialization via nlohmann::json
  • std::format support for easy output
  • Single ownership semantics

Quick Start

Installation

<details> <summary><b>CMake with CPM (Recommended)</b></summary>

CPMAddPackage("gh:SiddiqSoft/GenProcessInfo#main") // replace main with specific version
target_link_libraries(${PROJECT_NAME} INTERFACE GenProcessInfo::GenProcessInfo)

</details>

<details> <summary><b>NuGet (Windows)</b></summary>

Install-Package SiddiqSoft.WinProcessInfo

</details>

<details> <summary><b>Manual</b></summary>

Copy include/siddiqsoft/GenProcessInfo.hpp to your project. </details>

Basic Usage

#include "siddiqsoft/GenProcessInfo.hpp"

int main() {
    siddiqsoft::GenProcessInfo procInfo;
    
    // Basic info available immediately
    std::cout << "Process ID: " << procInfo.processId << "\n";
    std::cout << "CPU Cores: " << procInfo.cpuCores << "\n";
    
    // Expensive operation - call sparingly
    procInfo.snapshot();
    std::cout << "Memory: " << procInfo.memWorkingSet << " KB\n";
    std::cout << "Threads: " << procInfo.cpuThreads << "\n";
    
    return 0;
}

<details> <summary><b>JSON Output Example</b></summary>

#include <format>
#include "nlohmann/json.hpp"
#include "siddiqsoft/GenProcessInfo.hpp"

int main() {
    siddiqsoft::GenProcessInfo procInfo;
    procInfo.snapshot();
    
    nlohmann::json j = procInfo;
    std::cout << j.dump(2) << "\n";
    
    return 0;
}

</details>

Requirements

  • C++23 or later (MSVC 2022+, GCC 13+, Clang 17+)
  • Windows 7+, Linux (with /proc), macOS 10.5+, or POSIX-compliant systems
  • Optional: nlohmann::json for JSON serialization

Platform Support

Platform Status Notes
Windows ✓ Full Windows 7 and later
Linux ✓ Full Requires /proc filesystem
macOS ⚠ Limited Thread count limited (requires Mach APIs)
Unix ⚠ Limited Generic POSIX fallback

API Reference

See API.md for comprehensive documentation including:

  • All public members and methods
  • Detailed parameter descriptions
  • Platform-specific behavior
  • Performance considerations
  • Complete usage examples
  • Thread safety notes

Key Methods

Method Description Cost
snapshot() Capture memory, handles, and thread count Expensive
uptime() Get elapsed time since object creation Cheap
getCurrentProcessId() Get current process ID (static) Cheap

Key Members

Member Type Description
processId unsigned long Current process ID
cpuCores unsigned long Available CPU cores
cpuThreads unsigned long Process thread count
cpuHandles unsigned long Open handles/file descriptors
memWorkingSet size_t Current memory in KB
memPeakWorkingSet size_t Peak memory in KB
memPrivate size_t Private memory in KB
nameHostname std::string DNS hostname
nameFqdn std::string Fully qualified domain name

See API.md for complete member documentation.

<details> <summary><b>Performance Tips</b></summary>

  1. Reuse instances - Create once, call snapshot() periodically
  2. Background thread - Call snapshot() in a low-priority background thread
  3. Cache results - Store values if frequent access is needed
  4. Avoid copies - Copy/move operations are deleted (single ownership) </details>

<details> <summary><b>Backward Compatibility</b></summary>

The library provides WinProcessInfo as an alias for GenProcessInfo:

siddiqsoft::WinProcessInfo procInfo;  // Legacy name still works

</details>

<details> <summary><b>License</b></summary>

BSD 3-Clause License - See LICENSE file </details>


<small align="right">

© 2021 Siddiq Software LLC. All rights reserved.

</small>

Product Compatible and additional computed target framework versions.
native native is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.5.5 42 5/19/2026
2.5.3 101 5/7/2026
2.5.2 93 5/7/2026
2.5.1 98 5/7/2026
2.5.0 94 5/7/2026
2.3.0 93 5/7/2026
2.2.0 90 5/6/2026
1.0.6 931 12/15/2021
1.0.5 968 11/20/2021
1.0.4 773 7/30/2021
1.0.3 756 7/30/2021
1.0.2 751 7/30/2021
1.0.1 764 7/30/2021

Major change to the API. See documentation https://github.com/SiddiqSoft/GenProcessInfo/blob/main/README.md