Comment 3 for bug 1316047

Revision history for this message
Dietmar Eggemann (dietmar-eggemann) wrote :

It's still not working with idlestat commit (commit def498a73e7fb47efded9b41d2e91c88110ce0a9, 2014-06-01).

Like you said, it's related to the expected format:

diff --git a/idlestat.c b/idlestat.c
index 9228618a5e70..33871fff7775 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -789,7 +789,7 @@ static struct cpuidle_datas *idlestat_load(const char *path)

        do {
                if (strstr(buffer, "cpu_idle")) {
- assert(sscanf(buffer, TRACE_FORMAT, &time, &state,
+ assert(sscanf(buffer, TRACE_CMD_FORMAT, &time, &state,
                                      &cpu) == 3);

                        if (start) {
@@ -802,7 +802,7 @@ static struct cpuidle_datas *idlestat_load(const char *path)
                        count++;
                        continue;
                } else if (strstr(buffer, "cpu_frequency")) {
- assert(sscanf(buffer, TRACE_FORMAT, &time, &freq,
+ assert(sscanf(buffer, TRACE_CMD_FORMAT, &time, &freq,
                                      &cpu) == 3);
                        assert(datas->pstates[cpu].pstate != NULL);
                        cpu_change_pstate(datas, cpu, freq, time);

If I use TRACE_CMD_FORMAT instead of TRACE_FORMAT, I can evaluate ASCII trace files from trace-cmd with idlestat which is one of the reqs.

So instead of:

$ idlestat -o trace.txt
idlestat: idlestat.c:793: idlestat_load: Assertion `sscanf(buffer, "%*[^]]] %*s %lf:%*[^=]=%u%*[^=]=%d", &time, &state, &cpu) == 3' failed.

I get:

$ idlestat -o trace.txt
Log is 12.270789 secs long with 5593 events
cpu0@state hits total(us) avg(us) min(us) max(us)
     POLL 455 216970.00 476.86 3.00 9721.00
     C1-SNB 99 445857.00 4503.61 360.00 10820.00
cpu0 wakeups name count
cpu1@state hits total(us) avg(us) min(us) max(us)
     POLL 432 133254.00 308.46 14.00 11139.00
     C1-SNB 262 493110.00 1882.10 384.00 18621.00
cpu1 wakeups name count
cpu2@state hits total(us) avg(us) min(us) max(us)
     POLL 1114 117450.00 105.43 7.00 28868.00
     C1-SNB 32 409670.00 12802.19 276.00 126962.00
cpu2 wakeups name count
cpu3@state hits total(us) avg(us) min(us) max(us)
     C1-SNB 29 578758.00 19957.17 761.00 200294.00
cpu3 wakeups name count
cpu4@state hits total(us) avg(us) min(us) max(us)
     POLL 37 97635.00 2638.78 7.00 96211.00
     C1-SNB 325 428380.00 1318.09 246.00 117725.00
cpu4 wakeups name count
cluster@state hits total(us) avg(us) min(us) max(us)
        C1-SNB 30 48256.00 1608.53 0.00 9926.00

even wo/ the topology information at the beginning of the ASCII file. Not sure about the cluster data though. Wakeups are missing too and the name of the C states is also not correct.

So I don't know why idlestat needs this extra substring e.g '.n..' in
<idle>-0 [001] .n.. 5883.994620: cpu_idle: state=4294967295 cpu_id=1 ???

We do need this postprocessing feature from idlestat to work w/ trace-cmd derived output.
Why does idlestat needs a different event string? Maybe you can specify a command line option to work w/ both, idlestat created trace.txt files and trace.txt files derived from trace-cmd?