intel / intel/pcm

Timestamp per measurement

Open
#467 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
3.3k
Forks
528
Avg merge
1h 40m
Merged PRs (30d)
2

Description

Hi,
This is a suggestion.

I'm working on detailed power consumption analysis for various workload patterns using PCM, and
I thought it would be a good idea to have a timestamp field per measurement result for time series
behavior analysis.

The below is an example of my local modification of 'pcm-power'
```
[root@host1 pcm]# build/bin/pcm-power 1

Intel(r) Performance Counter Monitor ($Format:%ci ID=%h$)

Power Monitoring Utility

===== Processor information =====
Linux arch_perfmon flag : yes

(snip)

----------------------------------------------------------------------------------------------
Timestamp (us): 1667463641461974 <== TIMESTAMP per measurement HERE
Time elapsed: 997 ms
Called sleep function for 1000 ms
S0; Uncore Freq: 2.40 Ghz; Core Freq: 1.69 Ghz; Core Power License 0: 100.00%; Core Power License 1: 0.00%; Core Power License 2: 0.00%;
S0P0; UPI Clocks: 1297835485; L0p Tx Cycles: 0.00%; L1 Cycles: 0.00%
S0P1; UPI Clocks: 1297837626; L0p Tx Cycles: 0.00%; L1 Cycles: 0.00%
(snip)
```

Also, my modifications are just below.
In this sense, this can be true for other tools like 'pcm-core', 'pcm-memory' etc.

```
# git log -n 1 --oneline
0b320ca (HEAD -> master, origin/master, origin/HEAD) Merge pull request #466 from intel/push-2022-10-31
# git diff
diff --git a/src/pcm-power.cpp b/src/pcm-power.cpp
index e9ebc74..3c414a9 100644
--- a/src/pcm-power.cpp
+++ b/src/pcm-power.cpp
@@ -357,6 +357,9 @@ int main(int argc, char * argv[])

if (!csv) cout << flush;

+ struct timeval timestamp;
+ gettimeofday(×tamp, NULL);
+
const auto delay_ms = calibratedSleep(delay, sysCmd, mainLoop, m);

AfterTime = m->getTickCount();
@@ -365,6 +368,7 @@ int main(int argc, char * argv[])

m->getAllCounterStates(dummySystemState, afterSocketState, dummyCoreStates, false);

+ cout << "Timestamp (us): " << (timestamp.tv_sec * 1000000 + timestamp.tv_sec) << "\n";
cout << "Time elapsed: " << AfterTime - BeforeTime << " ms\n";
cout << "Called sleep function for " << delay_ms << " ms\n";
for (uint32 socket = 0; socket < numSockets; ++socket)
```

Regards,
Masanori

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.