diff options
Diffstat (limited to 'src/collectors/idlejitter.plugin')
l--------- | src/collectors/idlejitter.plugin/README.md | 1 | ||||
-rw-r--r-- | src/collectors/idlejitter.plugin/integrations/idle_os_jitter.md | 118 | ||||
-rw-r--r-- | src/collectors/idlejitter.plugin/metadata.yaml | 90 | ||||
-rw-r--r-- | src/collectors/idlejitter.plugin/plugin_idlejitter.c | 91 |
4 files changed, 300 insertions, 0 deletions
diff --git a/src/collectors/idlejitter.plugin/README.md b/src/collectors/idlejitter.plugin/README.md new file mode 120000 index 000000000..1ce460b62 --- /dev/null +++ b/src/collectors/idlejitter.plugin/README.md @@ -0,0 +1 @@ +integrations/idle_os_jitter.md
\ No newline at end of file diff --git a/src/collectors/idlejitter.plugin/integrations/idle_os_jitter.md b/src/collectors/idlejitter.plugin/integrations/idle_os_jitter.md new file mode 100644 index 000000000..23a15d001 --- /dev/null +++ b/src/collectors/idlejitter.plugin/integrations/idle_os_jitter.md @@ -0,0 +1,118 @@ +<!--startmeta +custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/idlejitter.plugin/README.md" +meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/idlejitter.plugin/metadata.yaml" +sidebar_label: "Idle OS Jitter" +learn_status: "Published" +learn_rel_path: "Collecting Metrics/Synthetic Checks" +most_popular: False +message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" +endmeta--> + +# Idle OS Jitter + + +<img src="https://netdata.cloud/img/syslog.png" width="150"/> + + +Plugin: idlejitter.plugin +Module: idlejitter.plugin + +<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> + +## Overview + +Monitor delays in timing for user processes caused by scheduling limitations to optimize the system to run latency sensitive applications with minimal jitter, improving consistency and quality of service. + + +A thread is spawned that requests to sleep for fixed amount of time. When the system wakes it up, it measures how many microseconds have passed. The difference between the requested and the actual duration of the sleep, is the idle jitter. This is done dozens of times per second to ensure we have a representative sample. + + +This collector is supported on all platforms. + +This collector only supports collecting metrics from a single instance of this integration. + + +### Default Behavior + +#### Auto-Detection + +This integration will run by default on all supported systems. + +#### Limits + +The default configuration for this integration does not impose any limits on data collection. + +#### Performance Impact + +The default configuration for this integration is not expected to impose a significant performance impact on the system. + + +## Metrics + +Metrics grouped by *scope*. + +The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. + + + +### Per Idle OS Jitter instance + + + +This scope has no labels. + +Metrics: + +| Metric | Dimensions | Unit | +|:------|:----------|:----| +| system.idlejitter | min, max, average | microseconds lost/s | + + + +## Alerts + +There are no alerts configured by default for this integration. + + +## Setup + +### Prerequisites + +No action required. + +### Configuration + +#### File + +The configuration file name for this integration is `netdata.conf`. + +The file format is a modified INI syntax. The general structure is: + +```ini +[section1] + option1 = some value + option2 = some other value + +[section2] + option3 = some third value +``` +You can edit the configuration file using the `edit-config` script from the +Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration.md#the-netdata-config-directory). + +```bash +cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata +sudo ./edit-config netdata.conf +``` +#### Options + +This integration only supports a single configuration option, and most users will not need to change it. + + +| Name | Description | Default | Required | +|:----|:-----------|:-------|:--------:| +| loop time in ms | Specifies the target time for the data collection thread to sleep, measured in miliseconds. | 20 | no | + +#### Examples +There are no configuration examples. + + diff --git a/src/collectors/idlejitter.plugin/metadata.yaml b/src/collectors/idlejitter.plugin/metadata.yaml new file mode 100644 index 000000000..0ad946994 --- /dev/null +++ b/src/collectors/idlejitter.plugin/metadata.yaml @@ -0,0 +1,90 @@ +plugin_name: idlejitter.plugin +modules: + - meta: + plugin_name: idlejitter.plugin + module_name: idlejitter.plugin + monitored_instance: + name: Idle OS Jitter + link: '' + categories: + - data-collection.synthetic-checks + icon_filename: 'syslog.png' + related_resources: + integrations: + list: [] + info_provided_to_referring_integrations: + description: '' + keywords: + - latency + - jitter + most_popular: false + overview: + data_collection: + metrics_description: > + Monitor delays in timing for user processes caused by scheduling limitations to optimize the system to run + latency sensitive applications with minimal jitter, improving consistency and quality of service. + method_description: > + A thread is spawned that requests to sleep for fixed amount of time. When the system wakes it up, it + measures how many microseconds have passed. The difference between the requested and the actual duration of + the sleep, is the idle jitter. This is done dozens of times per second to ensure we have a representative sample. + supported_platforms: + include: [] + exclude: [] + multi_instance: false + additional_permissions: + description: '' + default_behavior: + auto_detection: + description: 'This integration will run by default on all supported systems.' + limits: + description: '' + performance_impact: + description: '' + setup: + prerequisites: + list: [] + configuration: + file: + name: 'netdata.conf' + section: 'plugin:idlejitter' + description: '' + options: + description: > + This integration only supports a single configuration option, and most users will not need to change it. + folding: + title: '' + enabled: false + list: + - name: loop time in ms + description: > + Specifies the target time for the data collection thread to sleep, measured in miliseconds. + default_value: 20 + required: false + examples: + folding: + enabled: true + title: '' + list: [] + troubleshooting: + problems: + list: [] + alerts: [] + metrics: + folding: + title: Metrics + enabled: false + description: "" + availability: [] + scopes: + - name: global + description: "" + labels: [] + metrics: + - name: system.idlejitter + description: CPU Idle Jitter + unit: "microseconds lost/s" + chart_type: line + dimensions: + - name: min + - name: max + - name: average diff --git a/src/collectors/idlejitter.plugin/plugin_idlejitter.c b/src/collectors/idlejitter.plugin/plugin_idlejitter.c new file mode 100644 index 000000000..f71c99ad1 --- /dev/null +++ b/src/collectors/idlejitter.plugin/plugin_idlejitter.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "daemon/common.h" + +#define CPU_IDLEJITTER_SLEEP_TIME_MS 20 + +static void cpuidlejitter_main_cleanup(void *ptr) { + worker_unregister(); + + struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr; + static_thread->enabled = NETDATA_MAIN_THREAD_EXITING; + + collector_info("cleaning up..."); + + static_thread->enabled = NETDATA_MAIN_THREAD_EXITED; +} + +void *cpuidlejitter_main(void *ptr) { + worker_register("IDLEJITTER"); + worker_register_job_name(0, "measurements"); + + netdata_thread_cleanup_push(cpuidlejitter_main_cleanup, ptr); + + usec_t sleep_ut = config_get_number("plugin:idlejitter", "loop time in ms", CPU_IDLEJITTER_SLEEP_TIME_MS) * USEC_PER_MS; + if(sleep_ut <= 0) { + config_set_number("plugin:idlejitter", "loop time in ms", CPU_IDLEJITTER_SLEEP_TIME_MS); + sleep_ut = CPU_IDLEJITTER_SLEEP_TIME_MS * USEC_PER_MS; + } + + RRDSET *st = rrdset_create_localhost( + "system" + , "idlejitter" + , NULL + , "idlejitter" + , NULL + , "CPU Idle Jitter" + , "microseconds lost/s" + , "idlejitter.plugin" + , NULL + , NETDATA_CHART_PRIO_SYSTEM_IDLEJITTER + , localhost->rrd_update_every + , RRDSET_TYPE_AREA + ); + RRDDIM *rd_min = rrddim_add(st, "min", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + RRDDIM *rd_max = rrddim_add(st, "max", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + RRDDIM *rd_avg = rrddim_add(st, "average", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + usec_t update_every_ut = localhost->rrd_update_every * USEC_PER_SEC; + struct timeval before, after; + + while (service_running(SERVICE_COLLECTORS)) { + int iterations = 0; + usec_t error_total = 0, + error_min = 0, + error_max = 0, + elapsed = 0; + + while (elapsed < update_every_ut) { + now_monotonic_high_precision_timeval(&before); + worker_is_idle(); + sleep_usec(sleep_ut); + worker_is_busy(0); + now_monotonic_high_precision_timeval(&after); + + usec_t dt = dt_usec(&after, &before); + elapsed += dt; + + usec_t error = dt - sleep_ut; + error_total += error; + + if(unlikely(!iterations || error < error_min)) + error_min = error; + + if(error > error_max) + error_max = error; + + iterations++; + } + + if(iterations) { + rrddim_set_by_pointer(st, rd_min, error_min); + rrddim_set_by_pointer(st, rd_max, error_max); + rrddim_set_by_pointer(st, rd_avg, error_total / iterations); + rrdset_done(st); + } + } + + netdata_thread_cleanup_pop(1); + return NULL; +} + |