Skip to content

Commit

Permalink
Merge tag '2024-08-09' into push-2024-08-09
Browse files Browse the repository at this point in the history
Change-Id: Ica265b3f666b7f7394051d9015b8b5b89fba31f5
  • Loading branch information
rdementi committed Aug 9, 2024
2 parents 33111e4 + 23eead4 commit 4635f40
Show file tree
Hide file tree
Showing 21 changed files with 819 additions and 304 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-cov-linux-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
ci-cov-linux-report.sh PCM.linux.and.python
- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: coverity-linux-and-python-report-${{ github.sha }}
path: "*-Report.pdf"
2 changes: 1 addition & 1 deletion .github/workflows/ci-cov-windows-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
c:\pcm\ci-cov-windows-report.ps1 PCM.windows-all
- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: coverity-windows-all-report-${{ github.sha }}
path: "*-Report.pdf"
2 changes: 1 addition & 1 deletion .github/workflows/ci-fuzz-micro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
echo "Fuzzing completed"
- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: fuzz-log-${{ github.sha }}
path: "build/fuzz-log.txt"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-fuzz-short.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
echo "Fuzzing completed"
- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: fuzz-log-${{ github.sha }}
path: "build/fuzz-log.txt"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
echo "Fuzzing completed"
- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: fuzz-log-${{ github.sha }}
path: "build/fuzz-log.txt"
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,55 +40,55 @@ jobs:
bash ${{ github.workspace }}/tests/test.sh 2>&1 | tee test-log.txt
- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: test-log-${{ github.sha }}
path: test-log.txt

- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: test-log-raw-tr-wo_ext-${{ github.sha }}
path: build/bin/raw_tr_wo_ext.csv

- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: test-log-raw-tr-wi_ext-${{ github.sha }}
path: build/bin/raw_tr_wi_ext.csv

- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: pcm-csv-${{ github.sha }}
path: build/bin/pcm.csv

- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: pcm-memory-csv-${{ github.sha }}
path: build/bin/pcm-memory.csv

- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: test-log-raw-tr-wi_ext-single_header-${{ github.sha }}
path: build/bin/raw_tr_wi_ext_single_header.csv

- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: test-log-raw-edp-${{ github.sha }}
path: build/bin/raw_edp.txt

- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: test-log-raw-json-${{ github.sha }}
path: build/bin/raw_json.json

- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: test-log-raw-edp-offlined-cores-${{ github.sha }}
path: build/bin/raw_edp_offlined_cores.txt
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
chdir ${{github.workspace}}\src\WinMSRDriver
msbuild MSR.vcxproj /p:Configuration=Release,Platform=x64 /t:Clean,Build /m
- name: upload-artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: PCMforWindows
path: build/bin/**/*
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: SARIF file
path: results.sarif
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if(UNIX) # APPLE, LINUX, FREE_BSD
message(STATUS "initial CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")

# required PCM common flags
set (PCM_COMMON_FLAGS "-Wno-unknown-pragmas -fPIC")
set (PCM_COMMON_FLAGS "-Wno-unknown-pragmas -fPIC -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\"")

if(LINUX)
set (PCM_COMMON_FLAGS "${PCM_COMMON_FLAGS} -Wextra -DPCM_USE_PERF")
Expand Down
4 changes: 2 additions & 2 deletions src/cpucounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9485,7 +9485,7 @@ uint64 ServerUncorePMUs::computeQPISpeed(const uint32 core_nr, const int cpumode
qpi_speed.resize(getNumQPIPorts());

auto getSpeed = [&] (size_t i) {
if (i == 1) return 0ULL; // link 1 should have the same speed as link 0, skip it
if (PCM::hasUPI(cpumodel) == false && i == 1) return 0ULL; // link 1 should have the same speed as link 0, skip it
uint64 result = 0;
if (PCM::hasUPI(cpumodel) == false && i < XPIRegisterLocation.size())
{
Expand Down Expand Up @@ -9571,7 +9571,7 @@ uint64 ServerUncorePMUs::computeQPISpeed(const uint32 core_nr, const int cpumode
getSpeedsAsync.push_back(std::async(std::launch::async, getSpeed, i));
}
for (size_t i = 0; i < getNumQPIPorts(); ++i) {
qpi_speed[i] = (i==1)? qpi_speed[0] : getSpeedsAsync[i].get(); // link 1 does not have own speed register, it runs with the speed of link 0
qpi_speed[i] = (PCM::hasUPI(cpumodel) == false && i==1)? qpi_speed[0] : getSpeedsAsync[i].get(); // link 1 does not have own speed register, it runs with the speed of link 0
}
if (PCM::hasUPI(cpumodel))
{
Expand Down
52 changes: 49 additions & 3 deletions src/dashboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,10 @@ std::string getPCMDashboardJSON(const PCMDashboardType type, int ns, int nu, int
dashboard.push(panel1);
}
};
scaled("Core Frequency", "GHz", "/1000000000");
for (size_t s = 0; s < NumSockets; ++s)
if (type == InfluxDB) {
scaled("Core Frequency", "GHz", "/1000000000");
}
for (size_t s = 0; type == InfluxDB && s < NumSockets; ++s)
{
const char * op = "/1000000000";
const auto S = std::to_string(s);
Expand Down Expand Up @@ -771,7 +773,34 @@ std::string getPCMDashboardJSON(const PCMDashboardType type, int ns, int nu, int
}
dashboard.push(panel);
dashboard.push(panel1);

auto stacked = [&] (const char * m, std::vector<const char *> metrics, size_t s, const bool core = false)
{
const auto S = std::to_string(s);
auto my_height = 3 * height / 2;
auto panel = std::make_shared<TimeSeriesPanel>(0, y, width, my_height, "Socket" + S + " " + std::string(m), "stacked %", true);
auto panel1 = std::make_shared<BarGaugePanel>(width, y, max_width - width, my_height, std::string("Current ") + m + " (%)");
y += my_height;
for (auto & metric : metrics)
{
std::shared_ptr<pcm::Target> t;
if (core)
{
t = createTarget(metric, influxDBCore_Aggregate_Core_Counters(S, metric), "");
}
else
{
t = createTarget(metric, influxDBUncore_Uncore_Counters(S, metric), "");
}
panel->push(t);
panel1->push(t);
}
dashboard.push(panel);
dashboard.push(panel1);
};
for (size_t s = 0; type == InfluxDB && s < NumSockets; ++s)
{
stacked("Memory Request Ratio", {"Local Memory Request Ratio", "Remote Memory Request Ratio"}, s);
}
auto upi = [&](const std::string & m, const bool utilization)
{
for (size_t s = 0; s < NumSockets; ++s)
Expand Down Expand Up @@ -871,6 +900,23 @@ std::string getPCMDashboardJSON(const PCMDashboardType type, int ns, int nu, int
dashboard.push(panel1);
};
derived("Instructions Per Cycle", "IPC", "Instructions Retired Any", "Clock Unhalted Thread");
for (size_t s = 0; type == InfluxDB && s < NumSockets; ++s)
{
stacked("Core Stalls", {
"Frontend Bound",
"Bad Speculation",
"Backend Bound",
"Retiring",
"Fetch Latency Bound",
"Fetch Bandwidth Bound",
"Branch Misprediction Bound",
"Machine Clears Bound",
"Memory Bound",
"Core Bound",
"Heavy Operations Bound",
"Light Operations Bound"
}, s, true);
}
derived("Active Frequency Ratio", "AFREQ", "Clock Unhalted Thread", "Clock Unhalted Ref");
derived("L3 Cache Misses Per Instruction", "L3 MPI", "L3 Cache Misses", "Instructions Retired Any");
derived("L2 Cache Misses Per Instruction", "L2 MPI", "L2 Cache Misses", "Instructions Retired Any");
Expand Down
5 changes: 3 additions & 2 deletions src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ namespace debug {
template<typename LVL, typename PF, typename F, typename L, typename... Args>
void dyn_debug_output( std::ostream& out, LVL level, PF pretty_function, F file, L line, Args... args ) {
std::stringstream ss;
auto now = time(nullptr);
ss << "DBG(" << std::dec << level << "): File '" << file << "', line '" << std::dec << line << "' :\n";
ss << "DBG(" << std::dec << level << "): " << pretty_function << ":\n";
ss << "DBG(" << std::dec << level << "): "; // Next code line will continue printing on this output line
ss << "DBG(" << std::dec << level << ") " << std::put_time( localtime(&now), "%F_%T: " ); // Next code line will continue printing on this output line
dyn_debug_output_helper( ss, args... );
out << ss.str() << std::flush;
}
Expand All @@ -57,6 +58,6 @@ namespace debug {

#define DBG( level, ... ) \
if ( debug::currentDebugLevel >= level ) \
debug::dyn_debug_output( std::cout, level, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
debug::dyn_debug_output( std::cerr, level, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)

} // namespace pcm
3 changes: 2 additions & 1 deletion src/pcm-raw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,14 @@ AddEventStatus addEventFromDB(PCM::RawPMUConfigs& curPMUConfigs, string fullEven
std::ifstream in(path);
if (!in.is_open())
{
const auto alt_path = std::string("/usr/share/pcm/") + path;
const auto alt_path = getInstallPathPrefix() + path;
in.open(alt_path);
if (!in.is_open())
{
err_msg = std::string("event file ") + path + " or " + alt_path + " is not available.";
throw std::invalid_argument(err_msg);
}
path = alt_path;
}
in.close();
break;
Expand Down
Loading

0 comments on commit 4635f40

Please sign in to comment.