4#ifndef _Stroika_Framework_SystemPerformance_Instruments_Process_h_
5#define _Stroika_Framework_SystemPerformance_Instruments_Process_h_ 1
7#include "Stroika/Frameworks/StroikaPreComp.h"
12#include "Stroika/Foundation/Containers/Mapping.h"
13#include "Stroika/Foundation/Containers/Sequence.h"
14#include "Stroika/Foundation/DataExchange/ObjectVariantMapper.h"
15#include "Stroika/Foundation/Execution/Process.h"
16#include "Stroika/Foundation/IO/FileSystem/Common.h"
17#include "Stroika/Frameworks/SystemPerformance/Instrument.h"
28namespace Stroika::Frameworks::SystemPerformance::Instruments::Process {
30 using Foundation::Containers::Mapping;
31 using Foundation::DataExchange::ObjectVariantMapper;
33 using Foundation::Time::DurationSeconds;
34 using Foundation::Time::TimePointSeconds;
36 using MemorySizeType = uint64_t;
59 optional<String> fProcessName;
64 optional<String> fUserName;
66 optional<String> fCommandLine;
67 optional<filesystem::path> fCurrentWorkingDirectory;
68 optional<Mapping<String, String>> fEnvironmentVariables;
69 optional<filesystem::path> fEXEPath;
74 optional<filesystem::path>
fRoot;
76 optional<Time::DateTime> fProcessStartedAt;
100 optional<RunStatus> fRunStatus;
157 optional<MemorySizeType> fPrivateBytes;
200 optional<unsigned int> fThreadCount;
212 optional<double> fCombinedIOWriteRate;
246 unsigned int fEstablished{};
247 unsigned int fListening{};
248 unsigned int fOther{};
250 optional<TCPStats> fTCPStats;
278 const inline MeasurementType kProcessMapMeasurement{
"Process-Details"sv};
282 enum class CachePolicy {
283 eOmitUnchangedValues,
284 eIncludeAllRequestedValues,
293 using FilterFunctionType = function<bool (pid_t pid,
const filesystem::path& processPath)>;
309 FilterFunctionType fCaptureCommandLine{[] (pid_t ,
const filesystem::path& ) ->
bool {
return true; }};
311 bool fCaptureEnvironmentVariables{
true};
312 bool fCaptureCurrentWorkingDirectory{
true};
313 bool fCaptureRoot{
true};
314 bool fCaptureTCPStatistics{
false};
315 optional<Set<pid_t>> fRestrictToPIDs;
316 optional<Set<pid_t>> fOmitPIDs;
317 CachePolicy fCachePolicy{CachePolicy::eIncludeAllRequestedValues};
319 enum ProcessNameReadPolicy {
324 ProcessNameReadPolicy fProcessNameReadPolicy{eOnlyIfEXENotRead};
325#if qStroika_Foundation_Common_Platform_POSIX
326 bool fAllowUse_ProcFS{
true};
327 bool fAllowUse_PS{
true};
328#elif qStroika_Foundation_Common_Platform_Windows
342 Instrument (
const Options& options = Options{});
353namespace Stroika::Frameworks::SystemPerformance {
370 constexpr EnumNames<Frameworks::SystemPerformance::Instruments::Process::ProcessType::RunStatus>
371 DefaultNames<Frameworks::SystemPerformance::Instruments::Process::ProcessType::RunStatus>::k{{{
372 {Frameworks::SystemPerformance::Instruments::Process::ProcessType::RunStatus::eRunning, L
"Running"},
373 {Frameworks::SystemPerformance::Instruments::Process::ProcessType::RunStatus::eSleeping, L
"Sleeping"},
374 {Frameworks::SystemPerformance::Instruments::Process::ProcessType::RunStatus::eWaitingOnDisk, L
"WaitingOnDisk"},
375 {Frameworks::SystemPerformance::Instruments::Process::ProcessType::RunStatus::eWaitingOnPaging, L
"WaitingOnPaging"},
376 {Frameworks::SystemPerformance::Instruments::Process::ProcessType::RunStatus::eZombie, L
"Zombie"},
377 {Frameworks::SystemPerformance::Instruments::Process::ProcessType::RunStatus::eSuspended, L
"Suspended"},
#define Stroika_Define_Enum_Bounds(FIRST_ITEM, LAST_ITEM)
chrono::duration< double > DurationSeconds
chrono::duration<double> - a time span (length of time) measured in seconds, but high precision.
String is like std::u32string, except it is much easier to use, often much more space efficient,...
An Atom is like a String, except that its much cheaper to copy/store/compare, and the semantics of co...
ObjectVariantMapper can be used to map C++ types to and from variant-union types, which can be transp...
int pid_t
TODO - maybe move this to configuraiotn module???