diff options
author | Stefan Sauer <ensonic@users.sf.net> | 2012-12-17 19:12:01 +0100 |
---|---|---|
committer | Stefan Sauer <ensonic@users.sf.net> | 2012-12-17 20:09:29 +0100 |
commit | 7bd1a023bc1f2ed27476b0b28951e16761f64b99 (patch) | |
tree | e1ab86a4d86d50ac964bfe3385ebfb3b37a2b564 | |
parent | 9a17c79397be2a7795a97c28532c652c029210d5 (diff) |
rusage: log rusage unconditionally, limmit max_cpu load to playing state
-rw-r--r-- | src/gsttracelib.c | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/src/gsttracelib.c b/src/gsttracelib.c index ddc6038..184aab5 100644 --- a/src/gsttracelib.c +++ b/src/gsttracelib.c @@ -366,38 +366,31 @@ _log_common (GstClockTimeDiff treal) * cpufreq-selector -g performance * cpufreq-selector -g ondemand */ - if (check_cpuload) { + /* this is the total average, apply a window */ + //cpuload = (guint) gst_util_uint64_scale (tusersys, G_GINT64_CONSTANT(100), treal); + aspent+=dspent; + areal+=dreal; + if(areal > GST_SECOND) { + //if(areal > (GST_MSECOND*500)) { + cpuload = (guint) gst_util_uint64_scale (aspent, G_GINT64_CONSTANT(100), areal); /* we only want cpu-load in playing, otherwise max is almost always 100 */ - /* this is the total average, apply a window */ - //cpuload = (guint) gst_util_uint64_scale (tusersys, G_GINT64_CONSTANT(100), treal); - aspent+=dspent; - areal+=dreal; - if(areal > GST_SECOND) { - //if(areal > (GST_MSECOND*500)) { - cpuload = (guint) gst_util_uint64_scale (aspent, G_GINT64_CONSTANT(100), areal); - if (cpuload <= 100) { - if (cpuload > stats->max_cpuload) { - stats->max_cpuload = cpuload; - if (cpuload > max_cpuload) { - max_cpuload = cpuload; - } + if (check_cpuload && (cpuload <= 100)) { + if (cpuload > stats->max_cpuload) { + stats->max_cpuload = cpuload; + if (cpuload > max_cpuload) { + max_cpuload = cpuload; } } - else { - /* this happens during prerolling - printf("%" GST_TIME_FORMAT " %u\n", GST_TIME_ARGS (treal), cpuload); - */ - } - /* reset accumulators */ - aspent = areal = G_GUINT64_CONSTANT(0); - if (gsttl_do_log_rusage) { - /* FIXME: use rusage_%p, thread_id ? */ - _log_entry( - "rusage %" GST_TIME_FORMAT - " %lf %u %ld %ld\n", - GST_TIME_ARGS (treal), GSTTL_TIME_AS_SECOND (treal), - cpuload, ru.ru_nvcsw, ru.ru_nivcsw); - } + } + /* reset accumulators */ + aspent = areal = G_GUINT64_CONSTANT(0); + if (gsttl_do_log_rusage) { + /* FIXME: use rusage_%p, thread_id ? */ + _log_entry( + "rusage %" GST_TIME_FORMAT + " %lf %u %ld %ld\n", + GST_TIME_ARGS (treal), GSTTL_TIME_AS_SECOND (treal), + cpuload, ru.ru_nvcsw, ru.ru_nivcsw); } } #endif |