Skip to content

Commit

Permalink
Adapt README to process monitor and default tags
Browse files Browse the repository at this point in the history
  • Loading branch information
awegrzyn committed May 15, 2020
1 parent 032beeb commit 11737fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ The derived value is generated only from the first value of the metric and it is
See how it works in the example: [examples/4-RateDerivedMetric.cxx](examples/4-RateDerivedMetric.cxx).
### Global tags
Global tags are added to each metric sent using given monitoring instance. Two tags: `hostname` and `name` (process name) are set as global by default.
Global tags are added to each metric sent using given monitoring instance. `hostname` is set as global by default.
You can add your own global tag by calling `addGlobalTag(std::string_view key, std::string_view value)` or `addGlobalTag(tags::Key, tags::Value)`.
Expand All @@ -148,10 +148,10 @@ This feature provides basic performance status of the process. Note that is runs
```cpp
enableProcessMonitoring([interval in seconds]);
```
The following metrics are generated every interval:
+ **cpuUsedPercentage** - percentage of a core usage over time interval
+ **involuntaryContextSwitches** - involuntary context switches over time interval
+ **memoryUsagePercentage** - ratio of the process's resident set size to the physical memory on the machine, expressed as a percentage (Linux only)
The `processPerformance` metric is generated every interval with following values:
+ **cpu_used_pct** - percentage of a core usage over time interval
+ **involuntary_context_switches** - involuntary context switches over time interval
+ **memory_used_pct** - ratio of the process's resident set size to the physical memory on the machine, expressed as a percentage (Linux only)

### StdOut backend output format
```
Expand Down
2 changes: 1 addition & 1 deletion src/ProcessMonitor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Metric ProcessMonitor::getCpuAndContexts()
double fractionCpuUsed = (currentUsage.ru_utime.tv_sec * 1000000.0 + currentUsage.ru_utime.tv_usec - (mPreviousGetrUsage.ru_utime.tv_sec * 1000000.0 + mPreviousGetrUsage.ru_utime.tv_usec) + currentUsage.ru_stime.tv_sec * 1000000.0 + currentUsage.ru_stime.tv_usec - (mPreviousGetrUsage.ru_stime.tv_sec * 1000000.0 + mPreviousGetrUsage.ru_stime.tv_usec)) / timePassed;

Metric metric{"processPerformance"};
metric.addValue(static_cast<double>(std::round(fractionCpuUsed * 100.0 * 100.0) / 100.0), "cpu_user_pct");
metric.addValue(static_cast<double>(std::round(fractionCpuUsed * 100.0 * 100.0) / 100.0), "cpu_used_pct");
metric.addValue(static_cast<uint64_t>(currentUsage.ru_nivcsw - mPreviousGetrUsage.ru_nivcsw), "involuntary_context_switches");

mTimeLastRun = timeNow;
Expand Down

0 comments on commit 11737fd

Please sign in to comment.