From 4f6cfa8f82c3eb2264be7261812663660d6d5a07 Mon Sep 17 00:00:00 2001 From: "Dementiev, Roman" Date: Tue, 9 Jul 2024 09:12:19 +0200 Subject: [PATCH 01/10] add pcm-tpmi test Change-Id: I7846c77095e439623624ee049c460c337733b96e --- tests/test.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test.sh b/tests/test.sh index 5496fe8a..b31277db 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -117,6 +117,13 @@ if [ "$?" -ne "0" ]; then exit 1 fi +echo Testing pcm-tpmi +./pcm-tpmi 2 0x10 -d -b 26:26 +if [ "$?" -ne "0" ]; then + echo "Error in pcm-tpmi" + exit 1 +fi + echo Testing pcm-numa ./pcm-numa -- sleep 1 if [ "$?" -ne "0" ]; then From 8ffd51bdcce745261de7dae7c2dc310ed1ecc1b1 Mon Sep 17 00:00:00 2001 From: Roman Dementiev Date: Tue, 9 Jul 2024 13:54:47 +0200 Subject: [PATCH 02/10] add Linux distro detection --- src/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 20a98490..c8703b1e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,16 @@ else() file(GLOB UNUX_SOURCES dashboard.cpp resctrl.cpp) endif() +if (LINUX) + file(STRINGS "/etc/os-release" OS_RELEASE_CONTENTS) + foreach(LINE ${OS_RELEASE_CONTENTS}) + if(LINE MATCHES "^ID=") + string(REGEX REPLACE "^ID=\"?\([a-zA-Z]+\)\"?" "\\1" OS_ID ${LINE}) + endif() + endforeach() + message(STATUS "Detected Linux distribution: ${OS_ID}") +endif() + if(UNIX) # LINUX, FREE_BSD, APPLE if (NOT APPLE) set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} -s") # --strip-unneeded for packaging From 69261acc92e3645f605685b931ca7568c74f2464 Mon Sep 17 00:00:00 2001 From: Roman Dementiev Date: Tue, 9 Jul 2024 15:02:29 +0200 Subject: [PATCH 03/10] compile with NO_STATIC_LIBASAN on CentOS --- src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c8703b1e..43da1740 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,6 +26,11 @@ if (LINUX) message(STATUS "Detected Linux distribution: ${OS_ID}") endif() +if(OS_ID STREQUAL "centos") + set(NO_STATIC_LIBASAN 1) + message(STATUS "CentOS detected, using dynamic libasan") +endif() + if(UNIX) # LINUX, FREE_BSD, APPLE if (NOT APPLE) set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} -s") # --strip-unneeded for packaging @@ -58,6 +63,7 @@ if(UNIX) # LINUX, FREE_BSD, APPLE ) if(NO_STATIC_LIBASAN) + message(STATUS "Using dynamic libasan") set(PCM_DYNAMIC_ASAN "asan") set(PCM_STATIC_ASAN "") else() From 127ffea4174373722d0eecbbb38518e3d694be66 Mon Sep 17 00:00:00 2001 From: Roman Dementiev Date: Tue, 9 Jul 2024 18:46:54 +0200 Subject: [PATCH 04/10] grafana: add core and uncore frequencies --- src/cpucounters.h | 19 ++++++++++++++ src/dashboard.cpp | 55 ++++++++++++++++++++++++++++----------- src/pcm-sensor-server.cpp | 15 +++++++++++ 3 files changed, 74 insertions(+), 15 deletions(-) diff --git a/src/cpucounters.h b/src/cpucounters.h index 9a10370b..e38190ee 100644 --- a/src/cpucounters.h +++ b/src/cpucounters.h @@ -4078,6 +4078,25 @@ double getAverageUncoreFrequency(const UncoreStateType& before, const UncoreStat return double(m->getNumOnlineCores()) * getAverageFrequencyFromClocks(after.UncClocks - before.UncClocks, before, after) / double(m->getNumOnlineSockets()); } +/*! \brief Computes uncore frequency for all dies + + \param before CPU counter state before the experiment + \param after CPU counter state after the experiment + \return frequency in Hz +*/ +template +std::vector getUncoreFrequencies(const UncoreStateType& before, const UncoreStateType & after) // in Hz +{ + auto m = PCM::getInstance(); + assert(m); + std::vector uncoreFrequencies{getUncoreFrequency(after)}; + if (m->uncoreFrequencyMetricAvailable()) + { + uncoreFrequencies.push_back(getAverageUncoreFrequency(before, after)); + } + return uncoreFrequencies; +} + /*! \brief Computes average core frequency when not in powersaving C0-state (also taking Intel Turbo Boost technology into account) \param before CPU counter state before the experiment diff --git a/src/dashboard.cpp b/src/dashboard.cpp index 01ad32d6..0e64c734 100644 --- a/src/dashboard.cpp +++ b/src/dashboard.cpp @@ -586,6 +586,45 @@ std::string getPCMDashboardJSON(const PCMDashboardType type, int ns, int nu, int t = std::make_shared(title, prometheusExpr); return t; }; + auto scaled = [&] (const char * m, const char * unit, const char * op, const bool total = true) + { + auto panel = std::make_shared(0, y, width, height, std::string(m), unit, false); + auto panel1 = std::make_shared(width, y, max_width - width, height, std::string(m) + " (" + unit + ")"); + y += height; + for (size_t s = 0; s < NumSockets; ++s) + { + const auto S = std::to_string(s); + auto t = createTarget("Socket" + S, influxDBCore_Aggregate_Core_Counters(S, m) + op, prometheusCounters(S, m) + op); + panel->push(t); + panel1->push(t); + } + if (total) + { + auto t = createTarget("Total", influxDBCore_Aggregate_Core_Counters(m) + op, prometheusCounters(m) + op); + panel->push(t); + panel1->push(t); + dashboard.push(panel); + dashboard.push(panel1); + } + }; + scaled("Core Frequency", "GHz", "/1000000000"); + for (size_t s = 0; s < NumSockets; ++s) + { + const char * op = "/1000000000"; + const auto S = std::to_string(s); + auto panel = std::make_shared(0, y, width, height, std::string("Socket") + S + " Uncore Frequencies", "GHz", false); + auto panel1 = std::make_shared(width, y, max_width - width, height, std::string("Current Socket") + S + " Uncore Frequencies (GHz)"); + y += height; + for (size_t d = 0; d < (std::max)(pcm->getNumUFSDies(), (size_t)1ULL); ++d) + { + auto m = std::string("Uncore Frequency Die ") + std::to_string(d); + auto t = createTarget(m, influxDBUncore_Uncore_Counters(S, m) + op, prometheusCounters(S, m, false) + op); + panel->push(t); + panel1->push(t); + } + dashboard.push(panel); + dashboard.push(panel1); + } { auto panel = std::make_shared(0, y, width, height, "Memory Bandwidth", "MByte/sec", false); auto panel1 = std::make_shared(width, y, max_width - width, height, "Memory Bandwidth (MByte/sec)"); @@ -807,21 +846,7 @@ std::string getPCMDashboardJSON(const PCMDashboardType type, int ns, int nu, int derived("L2 Cache Misses Per Instruction", "L2 MPI", "L2 Cache Misses", "Instructions Retired Any"); for (auto & m : {"Instructions Retired Any", "Clock Unhalted Thread", "L2 Cache Hits", "L2 Cache Misses", "L3 Cache Hits", "L3 Cache Misses"}) { - auto panel = std::make_shared(0, y, width, height, std::string(m), "Million", false); - auto panel1 = std::make_shared(width, y, max_width - width, height, std::string(m) + " (Million)"); - y += height; - for (size_t s = 0; s < NumSockets; ++s) - { - const auto S = std::to_string(s); - auto t = createTarget("Socket" + S, influxDBCore_Aggregate_Core_Counters(S, m) + "/1000000", prometheusCounters(S, m) + "/1000000"); - panel->push(t); - panel1->push(t); - } - auto t = createTarget("Total", influxDBCore_Aggregate_Core_Counters(m) + "/1000000", prometheusCounters(m) + "/1000000"); - panel->push(t); - panel1->push(t); - dashboard.push(panel); - dashboard.push(panel1); + scaled(m, "Million", "/1000000"); } if (pcm->getAccel() != ACCEL_NOCONFIG){ auto accelCounters = [&](const std::string & m) diff --git a/src/pcm-sensor-server.cpp b/src/pcm-sensor-server.cpp index b17e7d64..11bc7447 100644 --- a/src/pcm-sensor-server.cpp +++ b/src/pcm-sensor-server.cpp @@ -401,6 +401,9 @@ class JSONPrinter : Visitor printCounter( "L3 Cache Occupancy", getL3CacheOccupancy ( after ) ); printCounter( "Invariant TSC", getInvariantTSC ( before, after ) ); printCounter( "SMI Count", getSMICount ( before, after ) ); + + printCounter( "Core Frequency", getActiveAverageFrequency ( before, after ) ); + endObject( JSONPrinter::DelimiterAndNewLine, END_OBJECT ); //DBG( 2, "Invariant TSC before=", before.InvariantTSC, ", after=", after.InvariantTSC, ", difference=", after.InvariantTSC-before.InvariantTSC ); @@ -446,6 +449,11 @@ class JSONPrinter : Visitor printCounter( "PP0 Joules Consumed", getConsumedJoules ( 0, before, after ) ); printCounter( "PP1 Joules Consumed", getConsumedJoules ( 1, before, after ) ); printCounter( "DRAM Joules Consumed", getDRAMConsumedJoules ( before, after ) ); + auto uncoreFrequencies = getUncoreFrequencies( before, after ); + for (size_t i = 0; i < uncoreFrequencies.size(); ++i) + { + printCounter( std::string("Uncore Frequency Die ") + std::to_string(i), uncoreFrequencies[i]); + } uint32 i = 0; for ( ; i < ( PCM::MAX_C_STATE ); ++i ) { std::stringstream s; @@ -692,6 +700,8 @@ class PrometheusPrinter : Visitor printCounter( "L3 Cache Occupancy", getL3CacheOccupancy ( after ) ); printCounter( "Invariant TSC", getInvariantTSC ( before, after ) ); printCounter( "SMI Count", getSMICount ( before, after ) ); + + printCounter( "Core Frequency", getActiveAverageFrequency ( before, after ) ); //DBG( 2, "Invariant TSC before=", before.InvariantTSC, ", after=", after.InvariantTSC, ", difference=", after.InvariantTSC-before.InvariantTSC ); printCounter( "Thermal Headroom", after.getThermalHeadroom() ); @@ -734,6 +744,11 @@ class PrometheusPrinter : Visitor printCounter( "PP0 Joules Consumed", getConsumedJoules ( 0, before, after ) ); printCounter( "PP1 Joules Consumed", getConsumedJoules ( 1, before, after ) ); printCounter( "DRAM Joules Consumed", getDRAMConsumedJoules ( before, after ) ); + auto uncoreFrequencies = getUncoreFrequencies( before, after ); + for (size_t i = 0; i < uncoreFrequencies.size(); ++i) + { + printCounter( std::string("Uncore Frequency Die ") + std::to_string(i), uncoreFrequencies[i]); + } uint32 i = 0; for ( ; i <= ( PCM::MAX_C_STATE ); ++i ) { std::stringstream s; From 12f1893a23bf7bb7646bdc04428f6f81172fbadc Mon Sep 17 00:00:00 2001 From: Roman Dementiev Date: Tue, 9 Jul 2024 19:06:31 +0200 Subject: [PATCH 05/10] implement -DNO_ASAN=1 option --- CMakeLists.txt | 12 ++++++++++-- src/CMakeLists.txt | 27 +++++++++++++++++---------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7317172c..1678f9f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,13 +82,21 @@ if(UNIX) # APPLE, LINUX, FREE_BSD elseif() set (PCM_DYNAMIC "") endif() - set(PCM_HARDENING_FLAGS "-fPIE -fstack-protector -D_FORTIFY_SOURCE=2 -ftrapv -fsanitize=address -fwrapv -fno-delete-null-pointer-checks -fno-strict-overflow -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer") + if(NO_ASAN) + message(STATUS "AddressSanitizer is disabled") + set(PCM_ASAN "") + else() + message(STATUS "AddressSanitizer is enabled") + message(STATUS "To disable AddressSanitizer, use -DNO_ASAN=1 option") + set(PCM_ASAN "-fsanitize=address") + endif() + set(PCM_HARDENING_FLAGS "-fPIE -fstack-protector -D_FORTIFY_SOURCE=2 -ftrapv ${PCM_ASAN} -fwrapv -fno-delete-null-pointer-checks -fno-strict-overflow -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5) message(WARNING "Old gcc compiler (version < 5), -fsanitize=undefined option is not supported.") elseif() set(PCM_HARDENING_FLAGS "${PCM_HARDENING_FLAGS} -fsanitize=undefined") endif() - set(PCM_LINKER_HARDENING_FLAGS "-fsanitize=address") + set(PCM_LINKER_HARDENING_FLAGS "${PCM_ASAN}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PCM_LINKER_HARDENING_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PCM_LINKER_HARDENING_FLAGS}") set(CMAKE_CXX_FLAGS_RELEASE "${PCM_OPTIONAL_FLAGS} -O3 ${PCM_DYNAMIC} ${PCM_HARDENING_FLAGS}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 43da1740..5a665bfb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,9 +26,11 @@ if (LINUX) message(STATUS "Detected Linux distribution: ${OS_ID}") endif() -if(OS_ID STREQUAL "centos") - set(NO_STATIC_LIBASAN 1) - message(STATUS "CentOS detected, using dynamic libasan") +if(NOT DEFINED NO_ASAN) + if(OS_ID STREQUAL "centos") + set(NO_STATIC_LIBASAN 1) + message(STATUS "CentOS detected, using dynamic libasan") + endif() endif() if(UNIX) # LINUX, FREE_BSD, APPLE @@ -62,15 +64,20 @@ if(UNIX) # LINUX, FREE_BSD, APPLE $<$:PCM_SILENT> ) - if(NO_STATIC_LIBASAN) - message(STATUS "Using dynamic libasan") - set(PCM_DYNAMIC_ASAN "asan") + if(NO_ASAN) + set(PCM_DYNAMIC_ASAN "") set(PCM_STATIC_ASAN "") else() - set(PCM_DYNAMIC_ASAN "") - set(PCM_STATIC_ASAN "-static-libasan") - message(STATUS "Using static libasan") - message(STATUS "To use dynamic libasan, use -DNO_STATIC_LIBASAN=1 option (required for CentOS)") + if(NO_STATIC_LIBASAN) + message(STATUS "Using dynamic libasan") + set(PCM_DYNAMIC_ASAN "asan") + set(PCM_STATIC_ASAN "") + else() + set(PCM_DYNAMIC_ASAN "") + set(PCM_STATIC_ASAN "-static-libasan") + message(STATUS "Using static libasan") + message(STATUS "To use dynamic libasan, use -DNO_STATIC_LIBASAN=1 option (required for CentOS)") + endif() endif() if(APPLE) From cf7b7ad04c008e89a6140ec7df049c8bfba27f39 Mon Sep 17 00:00:00 2001 From: "Dementiev, Roman" Date: Tue, 9 Jul 2024 19:43:42 +0200 Subject: [PATCH 06/10] code re-formatting Change-Id: I0f31d8411fb4b77aa750af006ab3494774f8e4ac --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5a665bfb..530a1003 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,9 +19,9 @@ endif() if (LINUX) file(STRINGS "/etc/os-release" OS_RELEASE_CONTENTS) foreach(LINE ${OS_RELEASE_CONTENTS}) - if(LINE MATCHES "^ID=") - string(REGEX REPLACE "^ID=\"?\([a-zA-Z]+\)\"?" "\\1" OS_ID ${LINE}) - endif() + if(LINE MATCHES "^ID=") + string(REGEX REPLACE "^ID=\"?\([a-zA-Z]+\)\"?" "\\1" OS_ID ${LINE}) + endif() endforeach() message(STATUS "Detected Linux distribution: ${OS_ID}") endif() From bc03048b9fe06075797968df8cd5c5353155ba9e Mon Sep 17 00:00:00 2001 From: Roman Dementiev Date: Wed, 10 Jul 2024 11:25:51 +0200 Subject: [PATCH 07/10] grafana: show energy charts after freq charts --- src/dashboard.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/dashboard.cpp b/src/dashboard.cpp index 0e64c734..8242fca7 100644 --- a/src/dashboard.cpp +++ b/src/dashboard.cpp @@ -625,6 +625,21 @@ std::string getPCMDashboardJSON(const PCMDashboardType type, int ns, int nu, int dashboard.push(panel); dashboard.push(panel1); } + for (size_t s = 0; s < NumSockets; ++s) + { + const auto S = std::to_string(s); + auto panel = std::make_shared(0, y, width, height, std::string("Socket") + S + " Energy Consumption", "Watt", false); + auto panel1 = std::make_shared(width, y, max_width - width, height, std::string("Current Socket") + S + " Energy Consumption (Watt)"); + y += height; + for (auto &m : {"Package Joules Consumed", "DRAM Joules Consumed", "PP0 Joules Consumed", "PP1 Joules Consumed"}) + { + auto t = createTarget(m, influxDBUncore_Uncore_Counters(S, m), prometheusCounters(S, m, false)); + panel->push(t); + panel1->push(t); + } + dashboard.push(panel); + dashboard.push(panel1); + } { auto panel = std::make_shared(0, y, width, height, "Memory Bandwidth", "MByte/sec", false); auto panel1 = std::make_shared(width, y, max_width - width, height, "Memory Bandwidth (MByte/sec)"); @@ -874,21 +889,6 @@ std::string getPCMDashboardJSON(const PCMDashboardType type, int ns, int nu, int accelCounters(accs->getAccelIndexCounterName(j)); } } - for (size_t s = 0; s < NumSockets; ++s) - { - const auto S = std::to_string(s); - auto panel = std::make_shared(0, y, width, height, std::string("Socket") + S + " Energy Consumption", "Watt", false); - auto panel1 = std::make_shared(width, y, max_width - width, height, std::string("Current Socket") + S + " Energy Consumption (Watt)"); - y += height; - for (auto &m : {"Package Joules Consumed", "DRAM Joules Consumed", "PP0 Joules Consumed", "PP1 Joules Consumed"}) - { - auto t = createTarget(m, influxDBUncore_Uncore_Counters(S, m), prometheusCounters(S, m, false)); - panel->push(t); - panel1->push(t); - } - dashboard.push(panel); - dashboard.push(panel1); - } return dashboard(); } From b89c8cc81f9378973ec1a123f4c7224389f72f77 Mon Sep 17 00:00:00 2001 From: Roman Dementiev Date: Wed, 10 Jul 2024 11:26:32 +0200 Subject: [PATCH 08/10] grafana: change the refresh period to 1s --- .../provisioning/dashboards/pcm-provider.yml | 2 +- scripts/grafana/start-prometheus.sh | 2 +- scripts/grafana/start.sh | 2 +- scripts/grafana/telegraf.conf.template | 2 +- src/dashboard.cpp | 19 +++++++++++++++++-- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/scripts/grafana/provisioning/dashboards/pcm-provider.yml b/scripts/grafana/provisioning/dashboards/pcm-provider.yml index f6ccfd4e..acd959bd 100644 --- a/scripts/grafana/provisioning/dashboards/pcm-provider.yml +++ b/scripts/grafana/provisioning/dashboards/pcm-provider.yml @@ -16,7 +16,7 @@ providers: # enable dashboard editing editable: true # how often Grafana will scan for changed dashboards - updateIntervalSeconds: 10 + updateIntervalSeconds: 1 # allow updating provisioned dashboards from the UI allowUiUpdates: false options: diff --git a/scripts/grafana/start-prometheus.sh b/scripts/grafana/start-prometheus.sh index 46e8dafd..31a59d91 100755 --- a/scripts/grafana/start-prometheus.sh +++ b/scripts/grafana/start-prometheus.sh @@ -68,6 +68,6 @@ ${CTR_RUN} network create prometheus-network || { echo "Error creating prometheu echo Starting prometheus ${CTR_RUN} run --name prometheus --network=prometheus-network -d -p 9090:9090 -v "$PWD"/prometheus.yml:/etc/prometheus/prometheus.yml:Z -v "$PWD"/prometheus_volume:/prometheus:Z quay.io/prometheus/prometheus:latest || { echo "Error starting prometheus"; exit 1; } echo Starting grafana -${CTR_RUN} run -d --network=prometheus-network --name=grafana -p 3000:3000 -v "$PWD"/grafana_volume:/var/lib/grafana:Z -v "$PWD"/provisioning:/etc/grafana/provisioning:Z docker.io/grafana/grafana:latest || { echo "Error starting grafana"; exit 1; } +${CTR_RUN} run -d --network=prometheus-network --name=grafana -p 3000:3000 -v "$PWD"/grafana_volume:/var/lib/grafana:Z -v "$PWD"/provisioning:/etc/grafana/provisioning:Z -e GF_DASHBOARDS_MIN_REFRESH_INTERVAL=1s docker.io/grafana/grafana:latest || { echo "Error starting grafana"; exit 1; } echo "Start browser at http://"`hostname`":3000/ or http://localhost:3000/ and login with admin user, password admin" diff --git a/scripts/grafana/start.sh b/scripts/grafana/start.sh index 5c1a6538..83e8c163 100755 --- a/scripts/grafana/start.sh +++ b/scripts/grafana/start.sh @@ -72,6 +72,6 @@ ${CTR_RUN} run -d --name influxdb -p 8083:8083 -p 8086:8086 --network=influxdb-n echo Starting telegraf ${CTR_RUN} run -d --name telegraf --network=influxdb-network -v "$PWD"/telegraf.conf:/etc/telegraf/telegraf.conf:ro telegraf || { echo "Error starting telegraf"; exit 1; } echo Starting grafana -${CTR_RUN} run -d --network=influxdb-network --name grafana -p 3000:3000 -v "$PWD"/provisioning:/etc/grafana/provisioning -v "$PWD"/grafana_volume:/var/lib/grafana grafana/grafana || { echo "Error starting grafana"; exit 1; } +${CTR_RUN} run -d --network=influxdb-network --name grafana -p 3000:3000 -v "$PWD"/provisioning:/etc/grafana/provisioning -v "$PWD"/grafana_volume:/var/lib/grafana -e GF_DASHBOARDS_MIN_REFRESH_INTERVAL=1s grafana/grafana || { echo "Error starting grafana"; exit 1; } echo "Start browser at http://"`hostname`":3000/ or http://localhost:3000/ and login with admin user, password admin" diff --git a/scripts/grafana/telegraf.conf.template b/scripts/grafana/telegraf.conf.template index a85a9c17..db656652 100644 --- a/scripts/grafana/telegraf.conf.template +++ b/scripts/grafana/telegraf.conf.template @@ -45,7 +45,7 @@ ## Default flushing interval for all outputs. You shouldn't set this below ## interval. Maximum flush_interval will be flush_interval + flush_jitter - flush_interval = "10s" + flush_interval = "1s" ## Jitter the flush interval by a random amount. This is primarily to avoid ## large write spikes for users running a large number of telegraf instances. ## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s diff --git a/src/dashboard.cpp b/src/dashboard.cpp index 8242fca7..7fe8e2e4 100644 --- a/src/dashboard.cpp +++ b/src/dashboard.cpp @@ -419,7 +419,7 @@ class Dashboard } result += R"PCMDELIMITER( ], - "refresh": "5s", + "refresh": "1s", "schemaVersion": 22, "style": "dark", "tags": [], @@ -456,7 +456,22 @@ class Dashboard "from": "now-5m", "to": "now" }, - "timepicker": {}, + "timepicker": { + "refresh_intervals": [ + "1s", + "2s", + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, "timezone": "", "title": ")PCMDELIMITER"; result += title; From 9bb5fbbc08f188ad4212f46be9f255cae38c81a2 Mon Sep 17 00:00:00 2001 From: Roman Dementiev Date: Fri, 12 Jul 2024 09:09:53 +0200 Subject: [PATCH 09/10] fix a crash due to uninitialized array --- src/cpucounters.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpucounters.cpp b/src/cpucounters.cpp index 470f9916..c8d7e034 100644 --- a/src/cpucounters.cpp +++ b/src/cpucounters.cpp @@ -3062,6 +3062,7 @@ PCM::PCM() : #ifdef PCM_USE_PERF canUsePerf = true; perfEventHandle.resize(num_cores, std::vector(PERF_MAX_COUNTERS, -1)); + std::fill(perfTopDownPos.begin(), perfTopDownPos.end(), 0); #endif for (int32 i = 0; i < num_cores; ++i) From fdc9cfe58d031253ada4ef1016762c57a4005474 Mon Sep 17 00:00:00 2001 From: "Dementiev, Roman" Date: Fri, 12 Jul 2024 10:36:22 +0200 Subject: [PATCH 10/10] fix locking in AcceleratorCounterState::getInstance() Change-Id: Ie45baf9328b37baa0deae5b403d8db6c1ac94f24 --- src/pcm-accel-common.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pcm-accel-common.cpp b/src/pcm-accel-common.cpp index c702e93c..dfd3f4ab 100644 --- a/src/pcm-accel-common.cpp +++ b/src/pcm-accel-common.cpp @@ -351,13 +351,16 @@ void readAccelCounters(SystemCounterState& sycs_) } AcceleratorCounterState* AcceleratorCounterState::instance = NULL; + +std::mutex instanceCreationMutexForAcceleratorCounterState{}; + AcceleratorCounterState * AcceleratorCounterState::getInstance() { // lock-free read // cppcheck-suppress identicalConditionAfterEarlyExit if (instance) return instance; - std::unique_lock instanceCreationMutex; + std::unique_lock _(instanceCreationMutexForAcceleratorCounterState); // cppcheck-suppress identicalConditionAfterEarlyExit if (instance) return instance;