Skip to content

Commit

Permalink
Make units compliant with IEC standard (netdata#4985)
Browse files Browse the repository at this point in the history
* Change GB to GiB

* Change MB to MiB in apps.plugin

* Change MB to MiB in cgroups.plugin

* Change MB to MiB in freebsd.plugin and macos.plugin

* Change MB to MiB in proc.plugin

* Change KB to KiB

* Change kB to KiB for divisor 1024

* Fix units for memory.failcnt

* Fix other units

* Change CPU time percentage

* Change kilobytes to KiB in apps.plugin

* Small fixes
  • Loading branch information
vlvkobal authored Dec 17, 2018
1 parent 928d4c5 commit 989604b
Show file tree
Hide file tree
Showing 27 changed files with 167 additions and 167 deletions.
2 changes: 1 addition & 1 deletion backends/backends.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ void *backends_main(void *ptr) {
rrddim_add(chart_metrics, "lost", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
rrddim_add(chart_metrics, "sent", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);

RRDSET *chart_bytes = rrdset_create_localhost("netdata", "backend_bytes", NULL, "backend", NULL, "Netdata Backend Data Size", "KB", "backends", NULL, 130610, global_backend_update_every, RRDSET_TYPE_AREA);
RRDSET *chart_bytes = rrdset_create_localhost("netdata", "backend_bytes", NULL, "backend", NULL, "Netdata Backend Data Size", "KiB", "backends", NULL, 130610, global_backend_update_every, RRDSET_TYPE_AREA);
rrddim_add(chart_bytes, "buffered", NULL, 1, 1024, RRD_ALGORITHM_ABSOLUTE);
rrddim_add(chart_bytes, "lost", NULL, 1, 1024, RRD_ALGORITHM_ABSOLUTE);
rrddim_add(chart_bytes, "sent", NULL, 1, 1024, RRD_ALGORITHM_ABSOLUTE);
Expand Down
28 changes: 14 additions & 14 deletions collectors/apps.plugin/apps_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,8 @@ static inline int read_proc_pid_status(struct pid_stat *p, void *ptr) {

p->uid = proc_info->ki_uid;
p->gid = proc_info->ki_groups[0];
p->status_vmsize = proc_info->ki_size / 1024; // in kB
p->status_vmrss = proc_info->ki_rssize * pagesize / 1024; // in kB
p->status_vmsize = proc_info->ki_size / 1024; // in KiB
p->status_vmrss = proc_info->ki_rssize * pagesize / 1024; // in KiB
// TODO: what about shared and swap memory on FreeBSD?
return 1;
#else
Expand Down Expand Up @@ -3196,7 +3196,7 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
}
send_END();
#endif

send_BEGIN(type, "minor_faults", dt);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
Expand Down Expand Up @@ -3290,19 +3290,19 @@ static void send_charts_updates_to_netdata(struct target *root, const char *type

// we have something new to show
// update the charts
fprintf(stdout, "CHART %s.cpu '' '%s CPU Time (%d%% = %d core%s)' 'cpu time %%' cpu %s.cpu stacked 20001 %d\n", type, title, (processors * 100), processors, (processors>1)?"s":"", type, update_every);
fprintf(stdout, "CHART %s.cpu '' '%s CPU Time (%d%% = %d core%s)' 'percentage' cpu %s.cpu stacked 20001 %d\n", type, title, (processors * 100), processors, (processors>1)?"s":"", type, update_every);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute 1 %llu %s\n", w->name, system_hz * RATES_DETAIL / 100, w->hidden ? "hidden" : "");
}

fprintf(stdout, "CHART %s.mem '' '%s Real Memory (w/o shared)' 'MB' mem %s.mem stacked 20003 %d\n", type, title, type, update_every);
fprintf(stdout, "CHART %s.mem '' '%s Real Memory (w/o shared)' 'MiB' mem %s.mem stacked 20003 %d\n", type, title, type, update_every);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute %ld %ld\n", w->name, 1L, 1024L);
}

fprintf(stdout, "CHART %s.vmem '' '%s Virtual Memory Size' 'MB' mem %s.vmem stacked 20005 %d\n", type, title, type, update_every);
fprintf(stdout, "CHART %s.vmem '' '%s Virtual Memory Size' 'MiB' mem %s.vmem stacked 20005 %d\n", type, title, type, update_every);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute %ld %ld\n", w->name, 1L, 1024L);
Expand All @@ -3320,28 +3320,28 @@ static void send_charts_updates_to_netdata(struct target *root, const char *type
fprintf(stdout, "DIMENSION %s '' absolute 1 1\n", w->name);
}

fprintf(stdout, "CHART %s.cpu_user '' '%s CPU User Time (%d%% = %d core%s)' 'cpu time %%' cpu %s.cpu_user stacked 20020 %d\n", type, title, (processors * 100), processors, (processors>1)?"s":"", type, update_every);
fprintf(stdout, "CHART %s.cpu_user '' '%s CPU User Time (%d%% = %d core%s)' 'percentage' cpu %s.cpu_user stacked 20020 %d\n", type, title, (processors * 100), processors, (processors>1)?"s":"", type, update_every);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute 1 %llu\n", w->name, system_hz * RATES_DETAIL / 100LLU);
}

fprintf(stdout, "CHART %s.cpu_system '' '%s CPU System Time (%d%% = %d core%s)' 'cpu time %%' cpu %s.cpu_system stacked 20021 %d\n", type, title, (processors * 100), processors, (processors>1)?"s":"", type, update_every);
fprintf(stdout, "CHART %s.cpu_system '' '%s CPU System Time (%d%% = %d core%s)' 'percentage' cpu %s.cpu_system stacked 20021 %d\n", type, title, (processors * 100), processors, (processors>1)?"s":"", type, update_every);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute 1 %llu\n", w->name, system_hz * RATES_DETAIL / 100LLU);
}

if(show_guest_time) {
fprintf(stdout, "CHART %s.cpu_guest '' '%s CPU Guest Time (%d%% = %d core%s)' 'cpu time %%' cpu %s.cpu_system stacked 20022 %d\n", type, title, (processors * 100), processors, (processors > 1) ? "s" : "", type, update_every);
fprintf(stdout, "CHART %s.cpu_guest '' '%s CPU Guest Time (%d%% = %d core%s)' 'percentage' cpu %s.cpu_system stacked 20022 %d\n", type, title, (processors * 100), processors, (processors > 1) ? "s" : "", type, update_every);
for (w = root; w; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute 1 %llu\n", w->name, system_hz * RATES_DETAIL / 100LLU);
}
}

#ifndef __FreeBSD__
fprintf(stdout, "CHART %s.swap '' '%s Swap Memory' 'MB' swap %s.swap stacked 20011 %d\n", type, title, type, update_every);
fprintf(stdout, "CHART %s.swap '' '%s Swap Memory' 'MiB' swap %s.swap stacked 20011 %d\n", type, title, type, update_every);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute %ld %ld\n", w->name, 1L, 1024L);
Expand Down Expand Up @@ -3373,25 +3373,25 @@ static void send_charts_updates_to_netdata(struct target *root, const char *type
fprintf(stdout, "DIMENSION %s '' absolute 1 %llu\n", w->name, RATES_DETAIL);
}
#else
fprintf(stdout, "CHART %s.preads '' '%s Disk Reads' 'kilobytes/s' disk %s.preads stacked 20002 %d\n", type, title, type, update_every);
fprintf(stdout, "CHART %s.preads '' '%s Disk Reads' 'KiB/s' disk %s.preads stacked 20002 %d\n", type, title, type, update_every);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute 1 %llu\n", w->name, 1024LLU * RATES_DETAIL);
}

fprintf(stdout, "CHART %s.pwrites '' '%s Disk Writes' 'kilobytes/s' disk %s.pwrites stacked 20002 %d\n", type, title, type, update_every);
fprintf(stdout, "CHART %s.pwrites '' '%s Disk Writes' 'KiB/s' disk %s.pwrites stacked 20002 %d\n", type, title, type, update_every);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute 1 %llu\n", w->name, 1024LLU * RATES_DETAIL);
}

fprintf(stdout, "CHART %s.lreads '' '%s Disk Logical Reads' 'kilobytes/s' disk %s.lreads stacked 20042 %d\n", type, title, type, update_every);
fprintf(stdout, "CHART %s.lreads '' '%s Disk Logical Reads' 'KiB/s' disk %s.lreads stacked 20042 %d\n", type, title, type, update_every);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute 1 %llu\n", w->name, 1024LLU * RATES_DETAIL);
}

fprintf(stdout, "CHART %s.lwrites '' '%s I/O Logical Writes' 'kilobytes/s' disk %s.lwrites stacked 20042 %d\n", type, title, type, update_every);
fprintf(stdout, "CHART %s.lwrites '' '%s I/O Logical Writes' 'KiB/s' disk %s.lwrites stacked 20042 %d\n", type, title, type, update_every);
for (w = root; w ; w = w->next) {
if(unlikely(w->exposed))
fprintf(stdout, "DIMENSION %s '' absolute 1 %llu\n", w->name, 1024LLU * RATES_DETAIL);
Expand Down
44 changes: 22 additions & 22 deletions collectors/cgroups.plugin/sys_fs_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ void update_systemd_services_charts(
, "services.mem_usage"
, (cgroup_used_memory_without_cache) ? "Systemd Services Used Memory without Cache"
: "Systemd Services Used Memory"
, "MB"
, "MiB"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 10
Expand All @@ -1512,7 +1512,7 @@ void update_systemd_services_charts(
, "mem"
, "services.mem_rss"
, "Systemd Services RSS Memory"
, "MB"
, "MiB"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 20
Expand All @@ -1533,7 +1533,7 @@ void update_systemd_services_charts(
, "mem"
, "services.mem_mapped"
, "Systemd Services Mapped Memory"
, "MB"
, "MiB"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 30
Expand All @@ -1554,7 +1554,7 @@ void update_systemd_services_charts(
, "mem"
, "services.mem_cache"
, "Systemd Services Cache Memory"
, "MB"
, "MiB"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 40
Expand All @@ -1575,7 +1575,7 @@ void update_systemd_services_charts(
, "mem"
, "services.mem_writeback"
, "Systemd Services Writeback Memory"
, "MB"
, "MiB"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 50
Expand All @@ -1596,7 +1596,7 @@ void update_systemd_services_charts(
, "mem"
, "services.mem_pgfault"
, "Systemd Services Memory Minor Page Faults"
, "MB/s"
, "MiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 60
Expand All @@ -1616,7 +1616,7 @@ void update_systemd_services_charts(
, "mem"
, "services.mem_pgmajfault"
, "Systemd Services Memory Major Page Faults"
, "MB/s"
, "MiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 70
Expand All @@ -1637,7 +1637,7 @@ void update_systemd_services_charts(
, "mem"
, "services.mem_pgpgin"
, "Systemd Services Memory Charging Activity"
, "MB/s"
, "MiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 80
Expand All @@ -1658,7 +1658,7 @@ void update_systemd_services_charts(
, "mem"
, "services.mem_pgpgout"
, "Systemd Services Memory Uncharging Activity"
, "MB/s"
, "MiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 90
Expand All @@ -1681,7 +1681,7 @@ void update_systemd_services_charts(
, "mem"
, "services.mem_failcnt"
, "Systemd Services Memory Limit Failures"
, "MB"
, "failures"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 110
Expand All @@ -1704,7 +1704,7 @@ void update_systemd_services_charts(
, "swap"
, "services.swap_usage"
, "Systemd Services Swap Memory Used"
, "MB"
, "MiB"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 100
Expand All @@ -1727,7 +1727,7 @@ void update_systemd_services_charts(
, "disk"
, "services.io_read"
, "Systemd Services Disk Read Bandwidth"
, "KB/s"
, "KiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 120
Expand All @@ -1748,7 +1748,7 @@ void update_systemd_services_charts(
, "disk"
, "services.io_write"
, "Systemd Services Disk Write Bandwidth"
, "KB/s"
, "KiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 130
Expand Down Expand Up @@ -1815,7 +1815,7 @@ void update_systemd_services_charts(
, "disk"
, "services.throttle_io_read"
, "Systemd Services Throttle Disk Read Bandwidth"
, "KB/s"
, "KiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 160
Expand All @@ -1836,7 +1836,7 @@ void update_systemd_services_charts(
, "disk"
, "services.throttle_io_write"
, "Systemd Services Throttle Disk Write Bandwidth"
, "KB/s"
, "KiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME
, NETDATA_CHART_PRIO_CGROUPS_SYSTEMD + 170
Expand Down Expand Up @@ -2317,7 +2317,7 @@ void update_cgroup_charts(int update_every) {
, "mem"
, "cgroup.mem"
, title
, "MB"
, "MiB"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_CGROUPS_NAME
, NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 210
Expand Down Expand Up @@ -2357,7 +2357,7 @@ void update_cgroup_charts(int update_every) {
, "mem"
, "cgroup.writeback"
, title
, "MB"
, "MiB"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_CGROUPS_NAME
, NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 300
Expand Down Expand Up @@ -2389,7 +2389,7 @@ void update_cgroup_charts(int update_every) {
, "mem"
, "cgroup.mem_activity"
, title
, "MB/s"
, "MiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_CGROUPS_NAME
, NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 400
Expand Down Expand Up @@ -2417,7 +2417,7 @@ void update_cgroup_charts(int update_every) {
, "mem"
, "cgroup.pgfaults"
, title
, "MB/s"
, "MiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_CGROUPS_NAME
, NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 500
Expand Down Expand Up @@ -2447,7 +2447,7 @@ void update_cgroup_charts(int update_every) {
, "mem"
, "cgroup.mem_usage"
, title
, "MB"
, "MiB"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_CGROUPS_NAME
, NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 200
Expand Down Expand Up @@ -2505,7 +2505,7 @@ void update_cgroup_charts(int update_every) {
, "disk"
, "cgroup.io"
, title
, "KB/s"
, "KiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_CGROUPS_NAME
, NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 1200
Expand Down Expand Up @@ -2565,7 +2565,7 @@ void update_cgroup_charts(int update_every) {
, "disk"
, "cgroup.throttle_io"
, title
, "KB/s"
, "KiB/s"
, PLUGIN_CGROUPS_NAME
, PLUGIN_CGROUPS_MODULE_CGROUPS_NAME
, NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 1200
Expand Down
4 changes: 2 additions & 2 deletions collectors/diskspace.plugin/plugin_diskspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
, family
, "disk.space"
, title
, "GB"
, "GiB"
, PLUGIN_DISKSPACE_NAME
, NULL
, NETDATA_CHART_PRIO_DISKSPACE_SPACE
Expand Down Expand Up @@ -303,7 +303,7 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) {
, family
, "disk.inodes"
, title
, "Inodes"
, "inodes"
, PLUGIN_DISKSPACE_NAME
, NULL
, NETDATA_CHART_PRIO_DISKSPACE_INODES
Expand Down
Loading

0 comments on commit 989604b

Please sign in to comment.