After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 627274 - cpureport: improve precision of cpu time information
cpureport: improve precision of cpu time information
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-08-18 15:26 UTC by Andoni Morales
Modified: 2016-05-31 16:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-cpureport-Improve-precission-of-cpu-time-information.patch (2.47 KB, patch)
2010-08-18 15:26 UTC, Andoni Morales
none Details | Review
0001-cpureport-make-use-of-a-monotic-clock-to-measure-act.patch (2.45 KB, patch)
2010-08-18 15:54 UTC, Andoni Morales
none Details | Review
0001-cpureport-make-use-of-a-monotic-clock-to-measure-act.patch (2.17 KB, patch)
2010-08-18 15:55 UTC, Andoni Morales
none Details | Review
0003-cpureport-Add-cpu-clock-properties.patch (5.17 KB, patch)
2010-08-20 08:02 UTC, Andoni Morales
none Details | Review
0004-cpureport-make-wall-time-and-cpu-time-portable.patch (6.01 KB, patch)
2010-08-20 08:02 UTC, Andoni Morales
none Details | Review
0001-cpureport-Improve-precission-of-cpu-time-information.patch (2.52 KB, patch)
2010-08-25 11:08 UTC, Andoni Morales
needs-work Details | Review
0002-cpureport-make-use-of-a-monotic-clock-to-measure-act.patch (2.12 KB, patch)
2010-08-25 11:08 UTC, Andoni Morales
needs-work Details | Review
0003-cpureport-Add-cpu-clock-properties.patch (5.03 KB, patch)
2010-08-25 11:09 UTC, Andoni Morales
needs-work Details | Review
0004-cpureport-make-wall-time-and-cpu-time-portable.patch (5.99 KB, patch)
2010-08-25 11:09 UTC, Andoni Morales
needs-work Details | Review

Description Andoni Morales 2010-08-18 15:26:12 UTC
Use clock_gettime() for a finer cpu time precission and send 'cpu-times' in nanoseconds to be consistent with 'actual-time'. This way we can get the cpu percent used with 'cpu-time' / 'actual-time' * 100
Comment 1 Andoni Morales 2010-08-18 15:26:50 UTC
Created attachment 168207 [details] [review]
0001-cpureport-Improve-precission-of-cpu-time-information.patch
Comment 2 Andoni Morales 2010-08-18 15:54:15 UTC
Created attachment 168208 [details] [review]
0001-cpureport-make-use-of-a-monotic-clock-to-measure-act.patch

Use a monotonic clock instead of the system time
Comment 3 Andoni Morales 2010-08-18 15:55:53 UTC
Created attachment 168209 [details] [review]
0001-cpureport-make-use-of-a-monotic-clock-to-measure-act.patch

Delete prints in previous patch
Comment 4 Zaheer Abbas Merali 2010-08-18 16:05:56 UTC
Comment on attachment 168209 [details] [review]
0001-cpureport-make-use-of-a-monotic-clock-to-measure-act.patch

Not all systems have a monotonic clock, so it would be better if there was a check done and it would use the monotonic clock if it exists otherwise fallback to the normal way.
Comment 5 Andoni Morales 2010-08-18 21:58:41 UTC
Does it makes sense to have to new properties:
 *wall-clock-type: CLOCK_MONOTONIC or CLOCK_REALTIME
 *cpu-clock-type: CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID

To benchmark encoders, for example, it makes sense to a use the thread cpu time to get values only from the encoding thread, isolating the rest of the tasks like decoding a non-raw source.
Comment 6 Zaheer Abbas Merali 2010-08-19 07:44:35 UTC
Sure sounds good.
Comment 7 Andoni Morales 2010-08-20 08:02:02 UTC
Created attachment 168371 [details] [review]
0003-cpureport-Add-cpu-clock-properties.patch
Comment 8 Andoni Morales 2010-08-20 08:02:41 UTC
Created attachment 168372 [details] [review]
0004-cpureport-make-wall-time-and-cpu-time-portable.patch
Comment 9 Andoni Morales 2010-08-25 11:08:07 UTC
Created attachment 168720 [details] [review]
0001-cpureport-Improve-precission-of-cpu-time-information.patch
Comment 10 Andoni Morales 2010-08-25 11:08:32 UTC
Created attachment 168721 [details] [review]
0002-cpureport-make-use-of-a-monotic-clock-to-measure-act.patch
Comment 11 Andoni Morales 2010-08-25 11:09:00 UTC
Created attachment 168722 [details] [review]
0003-cpureport-Add-cpu-clock-properties.patch
Comment 12 Andoni Morales 2010-08-25 11:09:41 UTC
Created attachment 168723 [details] [review]
0004-cpureport-make-wall-time-and-cpu-time-portable.patch
Comment 13 Sebastian Dröge (slomo) 2011-05-23 10:43:54 UTC
Review of attachment 168720 [details] [review]:

::: gst/debugutils/cpureport.c
@@ +114,2 @@
   g_get_current_time (&cur_time);
+  clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &cur_cpu_time);

Please add a configure check for this and conditionally use it. It's only available on POSIX it seems

@@ +124,3 @@
+      GST_TIMESPEC_TO_TIME (filter->last_cpu_time);
+
+  s = gst_structure_new ("cpu-report", "cpu-time", G_TYPE_INT64, cpu_time,

This breaks backward compatibility. Keep cpu-time as double and maybe add a cpu-time-ns as gint64 in nanoseconds
Comment 14 Sebastian Dröge (slomo) 2011-05-23 10:44:47 UTC
Review of attachment 168721 [details] [review]:

::: gst/debugutils/cpureport.c
@@ +114,1 @@
+  clock_gettime (CLOCK_MONOTONIC, &cur_time);

configure check for this too... and only use it conditionally if available. See core/configure.ac for a configure check for the monotonic clock
Comment 15 Andoni Morales 2011-05-23 10:46:59 UTC
I think this is handled in the 4th patch. Can you double check please?
Comment 16 Sebastian Dröge (slomo) 2011-05-23 10:48:00 UTC
Review of attachment 168722 [details] [review]:

::: gst/debugutils/cpureport.c
@@ +42,3 @@
+  static const GEnumValue cpu_clock_mode[] = {
+    {CLOCK_PROCESS_CPUTIME_ID, "Process cpu time", "process"},
+    {CLOCK_THREAD_CPUTIME_ID, "Thread cpu time", "thread"},

Are these defined to the same numbers everywhere? Otherwise please add your own constants for them and map them later to the POSIX constants.

And only use this conditionally if available. I think these are only available on POSIX too, for everything else just do what was done before.
Comment 17 Sebastian Dröge (slomo) 2011-05-23 10:49:53 UTC
Review of attachment 168723 [details] [review]:

ok, forget what I said about the configure checks before :) Still you should do something about the clock type constants... and all the other comments still apply too, especially the backwards compatible GstStructure
Comment 18 Tim-Philipp Müller 2012-10-26 23:23:42 UTC
Andoni: do you plan to update these patches?
Comment 19 Tim-Philipp Müller 2016-05-31 16:39:39 UTC
Closing due to years of inactivity. Please re-open if you/anyone plan to work on the patches, thanks!