@cryptotaxi247 / netdata-1 / commits / f458c64ba

Remove condition that was creating gaps on cachestat (#10972)

thiagoftsm committed Apr 15, 2021 at 17:11 UTC f458c64bac54eb89e7a873f7b8d4b9327e238f8d
2 files changed +6 -9
collectors/ebpf.plugin/ebpf_cachestat.c
+5 -8
@@ -122,7 +122,7 @@ void cachestat_update_publish(netdata_publish_cachestat_t *out, uint64_t mpa, ui
122 hits = 0;
123 }
124
125 - calculated_number ratio = (total > 0) ? hits/total : 0;
125 + calculated_number ratio = (total > 0) ? hits/total : 1;
126
127 out->ratio = (long long )(ratio*100);
128 out->hit = (long long)hits;
@@ -378,12 +378,9 @@ static void cachestat_send_global(netdata_publish_cachestat_t *publish)
378 calculate_stats(publish);
379
380 netdata_publish_syscall_t *ptr = cachestat_counter_publish_aggregated;
381 - // The algorithm sets this value to zero sometimes, we are not written them to have a smooth chart
382 - if (publish->ratio) {
383 - ebpf_one_dimension_write_charts(
384 - NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_HIT_RATIO_CHART, ptr[NETDATA_CACHESTAT_IDX_RATIO].dimension,
385 - publish->ratio);
386 - }
381 + ebpf_one_dimension_write_charts(
382 + NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_HIT_RATIO_CHART, ptr[NETDATA_CACHESTAT_IDX_RATIO].dimension,
383 + publish->ratio);
384
385 ebpf_one_dimension_write_charts(
386 NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_DIRTY_CHART, ptr[NETDATA_CACHESTAT_IDX_DIRTY].dimension,
@@ -535,7 +532,7 @@ static void ebpf_create_memory_charts()
532 {
533 ebpf_create_chart(NETDATA_EBPF_MEMORY_GROUP, NETDATA_CACHESTAT_HIT_RATIO_CHART,
534 "Hit is calculating using total cache added without dirties per total added because of red misses.",
538 - EBPF_CACHESTAT_DIMENSION_HITS, NETDATA_CACHESTAT_SUBMENU,
535 + EBPF_COMMON_DIMENSION_PERCENTAGE, NETDATA_CACHESTAT_SUBMENU,
536 NULL,
537 NETDATA_EBPF_CHART_TYPE_LINE,
538 21100,
web/gui/dashboard_info.js
+1 -1
@@ -1035,7 +1035,7 @@ netdataDashboard.context = {
1035 },
1036
1037 'mem.cachestat_ratio': {
1038 - info: 'When the processor needs to read or write a location in main memory, it checks for a corresponding entry in the page cache. If the entry is there, a page cache hit has occurred and the read is from the cache. If the entry is not there, a page cache miss has occurred and the kernel allocates a new entry and copies in data from the disk. Netdata calculates the percentage of accessed files that are cached on memory. <a href="https://github.com/iovisor/bcc/blob/master/tools/cachestat.py#L126-L138" target="_blank">The ratio</a> is calculated counting the accessed cached pages (without counting dirty pages and pages added because of read misses) divided by total access without dirty pages. The algorithm will not plot data when ratio is zero and our dashboard will interpolate the plot. '
1038 + info: 'When the processor needs to read or write a location in main memory, it checks for a corresponding entry in the page cache. If the entry is there, a page cache hit has occurred and the read is from the cache. If the entry is not there, a page cache miss has occurred and the kernel allocates a new entry and copies in data from the disk. Netdata calculates the percentage of accessed files that are cached on memory. <a href="https://github.com/iovisor/bcc/blob/master/tools/cachestat.py#L126-L138" target="_blank">The ratio</a> is calculated counting the accessed cached pages (without counting dirty pages and pages added because of read misses) divided by total access without dirty pages.'
1039 },
1040
1041 'mem.cachestat_dirties': {