Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp per measurement #467

Open
thatsdone opened this issue Nov 3, 2022 · 1 comment
Open

Timestamp per measurement #467

thatsdone opened this issue Nov 3, 2022 · 1 comment

Comments

@thatsdone
Copy link

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(&timestamp, 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

@rdementi
Copy link
Contributor

thanks for the suggestion. Since not users need this I would suggest to make it optional and also platform independent. Does it compile on Windows/FreeBSD/etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants