{"id":21327878,"url":"https://github.com/siddiqsoft/winprocessinfo","last_synced_at":"2025-03-16T00:15:28.604Z","repository":{"id":142736443,"uuid":"390961797","full_name":"SiddiqSoft/WinProcessInfo","owner":"SiddiqSoft","description":"Windows Process Information utility class","archived":false,"fork":false,"pushed_at":"2021-12-15T13:27:47.000Z","size":67,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-04-28T06:53:58.316Z","etag":null,"topics":["cpu-info","memory-info","nuget","process","thread-info","windows"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SiddiqSoft.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-30T06:48:07.000Z","updated_at":"2021-12-15T13:25:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"008b6073-330b-40cf-9822-b5155fb72df5","html_url":"https://github.com/SiddiqSoft/WinProcessInfo","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiddiqSoft%2FWinProcessInfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiddiqSoft%2FWinProcessInfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiddiqSoft%2FWinProcessInfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiddiqSoft%2FWinProcessInfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SiddiqSoft","download_url":"https://codeload.github.com/SiddiqSoft/WinProcessInfo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806087,"owners_count":20350775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpu-info","memory-info","nuget","process","thread-info","windows"],"created_at":"2024-11-21T21:20:20.611Z","updated_at":"2025-03-16T00:15:28.517Z","avatar_url":"https://github.com/SiddiqSoft.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"WinProcessInfo : Sample Windows process information\n-------------------------------------------\n\n[![CodeQL](https://github.com/SiddiqSoft/WinProcessInfo/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/SiddiqSoft/WinProcessInfo/actions/workflows/codeql-analysis.yml)\n[![Build Status](https://dev.azure.com/siddiqsoft/siddiqsoft/_apis/build/status/SiddiqSoft.WinProcessInfo?branchName=main)](https://dev.azure.com/siddiqsoft/siddiqsoft/_build/latest?definitionId=12\u0026branchName=main)\n![](https://img.shields.io/nuget/v/SiddiqSoft.WinProcessInfo)\n![](https://img.shields.io/github/v/tag/SiddiqSoft/WinProcessInfo)\n![](https://img.shields.io/azure-devops/tests/siddiqsoft/siddiqsoft/12)\n![](https://img.shields.io/azure-devops/coverage/siddiqsoft/siddiqsoft/12)\n\n# Objective\n\nProvide for a simple \"stats\" for a daemon/service without the heft of the full process information library.\n\n- Minimal footprint\n- Serializer for nlohmann::json (you must include the library prior to this header file)\n- Serializer for std::format (if supported by your compiler)\n\n\n# Requirements\n- We use [`nlohmann::json`](https://github.com/nlohmann/json) only in our tests and the library is aware to provide a conversion operator if library is detected.\n- We use `std::format` if present\n-\n# Usage\n\n- Use the nuget [SiddiqSoft.WinProcessInfo](https://www.nuget.org/packages/SiddiqSoft.WinProcessInfo/)\n- Copy paste..whatever works.\n\n## Interface\n\n```\nWinProcessInfo\n- uptime()\n- snapshot()\n- serializer for nlohmann::json\n- serializer for std::format\n```\n\n## Example\n\n```cpp\n#include \"gtest/gtest.h\"\n#include \u003cformat\u003e\n#include \"nlohmann/json.hpp\"\n#include \"siddiqsoft/WinProcessInfo.hpp\"\n\nTEST(examples, Example2)\n{\n   try {\n      siddiqsoft::WinProcessInfo procInfo;\n\n      // We must perform the snapshot to obtain memory and thread usage\n      procInfo.snapshot();\n\n      // tip: do not use brace-init/assignment as it will create an array instead of object!\n      nlohmann::json info(procInfo);\n\n      std::cerr \u003c\u003c info.dump() \u003c\u003c std::endl;\n      EXPECT_EQ(GetCurrentProcessId(), info.value(\"processId\", 0));\n   }\n   catch (std::exception\u0026 e) {\n      EXPECT_TRUE(false) \u003c\u003c e.what(); // if we throw then the test fails.\n   }\n}\n\n```\n\n\n## Output\n Member Field | json Field | Comments\n-------------:|:----------:|:-------------------\ncpuCores | `cpuCount` | Number of cores/cpu\ncpuHandles | `cpuHandles` | Handle count\ncpuThreads | `cpuThreads` | Thread count. _This is expensive._\nmemPeakWorkingSet | `memPeakWorkingSet` | Peak virtual working memory in Kbytes.\nmemWorkingSet | `memWorkingSet` | Current working set in Kbytes.\nmemPrivate | `memPrivate` | Current physically allocated memory for this process in Kbytes.\nnameHostname | `hostname` | The local hostname\nnameDomainName | `domain` | The fully qualified domain portion\nnameHostnamePhysical | `localFqdn` | The local physical hostname\nnameFqdn | `fqdn` | The fully qualified dns name\nprocessId | `processId` | The process id\ntimeStartup | `timeStartup` | The startup timestamp as ISO 8601 format. _This is the time of instance of this object._\n\u0026nbsp; | `timeCurrent` | The current timestamp as ISO 8601 format when the serialization took place.\n\u0026nbsp; | `uptime` | The number of _microseconds_ between the `timeStartup` and `timeCurrent`.\u003cbr/\u003eUse the method `uptime()` and `duration_cast\u003c\u003e` to your desired ratio.\n\n```json\n{\n    \"cpuCores\": 8,\n    \"cpuHandles\": 48,\n    \"cpuThreads\": 4,\n    \"domain\": \"\",\n    \"fqdn\": \"istanbul\",\n    \"hostname\": \"istanbul\",\n    \"localFqdn\": \"istanbul\",\n    \"memPeakWorkingSet\": 42960, // KBytes\n    \"memPrivateBytes\": 84452,   // Kbytes\n    \"memWorkingSet\": 42584,     // Kbytes\n    \"processId\": 10828,\n    \"timeCurrent\": \"2021-07-30T06:43:54.8649027Z\",\n    \"timeStartup\": \"2021-07-30T06:43:54.8599558Z\",\n    \"uptime\": 5124              // Microseconds\n}\n```\n\n\u003csmall align=\"right\"\u003e\n\n\u0026copy; 2021 Siddiq Software LLC. All rights reserved.\n\n\u003c/small\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddiqsoft%2Fwinprocessinfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddiqsoft%2Fwinprocessinfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddiqsoft%2Fwinprocessinfo/lists"}