{"id":15047497,"url":"https://github.com/ttldtor/process","last_synced_at":"2025-04-10T00:51:08.832Z","repository":{"id":193935149,"uuid":"689761293","full_name":"ttldtor/Process","owner":"ttldtor","description":"Cross-platform library of utilities for obtaining metrics of the current process","archived":false,"fork":false,"pushed_at":"2024-05-28T18:39:20.000Z","size":37,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"default","last_synced_at":"2025-04-10T00:51:02.950Z","etag":null,"topics":["cpp","cpp14","cpp17","cpp20"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ttldtor.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2023-09-10T20:16:43.000Z","updated_at":"2024-05-28T18:39:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"301cc4af-6cd5-46b1-ac2b-6cd5508b963d","html_url":"https://github.com/ttldtor/Process","commit_stats":null,"previous_names":["ttldtor/process"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttldtor%2FProcess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttldtor%2FProcess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttldtor%2FProcess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttldtor%2FProcess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttldtor","download_url":"https://codeload.github.com/ttldtor/Process/tar.gz/refs/heads/default","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137997,"owners_count":21053775,"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":["cpp","cpp14","cpp17","cpp20"],"created_at":"2024-09-24T20:59:14.058Z","updated_at":"2025-04-10T00:51:08.815Z","avatar_url":"https://github.com/ttldtor.png","language":"C++","readme":"# Process\nCross-platform library of utilities for obtaining metrics of the current process\n\n[![Build](https://github.com/ttldtor/Process/actions/workflows/build.yml/badge.svg?branch=default)](https://github.com/ttldtor/Process/actions/workflows/build.yml)\n[![Release](https://img.shields.io/github/v/release/ttldtor/Process)](https://github.com/ttldtor/Process/releases/latest)\n![](https://img.shields.io/badge/C++%20standard-C++14-blueviolet)\n[![License](https://img.shields.io/badge/license-BSL--1.0-orange)](https://github.com/ttldtor/Process/blob/default/LICENSE)\n[![Downloads](https://img.shields.io/github/downloads/ttldtor/Process/total)](https://github.com/ttldtor/Process/releases/latest)\n\n### Status:\n* [x] Windows\n* [x] Linux\n* [x] MacOS\n* [x] Android. [Example](https://github.com/ttldtor/ProcessExample)\n* [x] Termux\n* [x] FreeBSD\n* [ ] OpenBSD\n* [ ] NetBSD\n* [ ] Solaris\n* [ ] AIX\n* [ ] ...\n\n### Example:\n\n_**CMakeLists.txt:**_\n```cmake\ncmake_minimum_required(VERSION 3.20)\n\nproject(Test LANGUAGES CXX)\n\nset(CMAKE_CXX_STANDARD 14)\nset(CMAKE_C_STANDARD 11)\nset(CXX_EXTENSIONS OFF)\nset(C_EXTENSIONS OFF)\n\ninclude(FetchContent)\nFetchContent_Declare(Process GIT_REPOSITORY \"https://github.com/ttldtor/Process.git\" GIT_TAG default)\nFetchContent_MakeAvailable(Process)\n\nadd_executable(${PROJECT_NAME}\n        main.cpp\n)\n\ntarget_link_libraries(${PROJECT_NAME} PRIVATE process::process)\n\n```\n\n**_main.cpp:_**\n```cpp\n#include \u003cprocess/process.hpp\u003e\n\n#include \u003cchrono\u003e\n#include \u003ciostream\u003e\n#include \u003cvector\u003e\n\nusing namespace std::literals;\nusing namespace org::ttldtor::process;\n\nint main() {\n    auto now = [] {\n        return std::chrono::duration_cast\u003cstd::chrono::seconds\u003e(std::chrono::steady_clock::now().time_since_epoch())\n            .count();\n    };\n    std::cout \u003c\u003c \"Physical memory usage: \" \u003c\u003c Process::getPhysicalMemorySize() / 1024 \u003c\u003c \"KB\" \u003c\u003c std::endl;\n    std::cout \u003c\u003c \"Total CPU time: \" \u003c\u003c Process::getTotalProcessorTime().count() \u003c\u003c \"ms\" \u003c\u003c std::endl;\n\n    auto t1 = now();\n\n    while (now() - t1 \u003c= 5) {\n        static std::size_t i = 0;\n        (void)(i++);\n    }\n\n    std::cout \u003c\u003c \"Total CPU time (+5s): \" \u003c\u003c Process::getTotalProcessorTime().count() \u003c\u003c \"ms\" \u003c\u003c std::endl;\n    std::cout \u003c\u003c \"Physical memory usage: \" \u003c\u003c Process::getPhysicalMemorySize() / 1024 \u003c\u003c \"KB\" \u003c\u003c std::endl;\n    std::vector\u003cstd::uint8_t\u003e vb(10 * 1024 * 1024);\n    std::cout \u003c\u003c \"Physical memory usage (+10MB): \" \u003c\u003c Process::getPhysicalMemorySize() / 1024 \u003c\u003c \"KB\" \u003c\u003c std::endl;\n    vb.resize(1);\n    vb.shrink_to_fit();\n    std::cout \u003c\u003c \"Physical memory usage (-10MB): \" \u003c\u003c Process::getPhysicalMemorySize() / 1024 \u003c\u003c \"KB\" \u003c\u003c std::endl;\n}\n```\n\n_**Program output:**_\n```text\nPhysical memory usage: 4168KB\nTotal CPU time: 0ms\nTotal CPU time (+5s): 5609ms\nPhysical memory usage: 4212KB\nPhysical memory usage (+10MB): 14460KB\nPhysical memory usage (-10MB): 4216KB\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttldtor%2Fprocess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttldtor%2Fprocess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttldtor%2Fprocess/lists"}