Hi Arnaldo

In my case:

bash-4.1# sudo perf stat -e sched:sched_switch sleep 1

 Performance counter stats for 'sleep 1':

                 0 sched:sched_switch

       1.004714901 seconds time elapsed


And  if i do:

bash-4.1# perf stat -e cs sleep 1

 Performance counter stats for 'sleep 1':

                 1 cs

       1.003306642 seconds time elapsed

To enable sampling on sched:sched_switch my perf_event_attr look like:

        e_open->attr.disabled           = 1;
        e_open->attr.type                  = PERF_TYPE_TRACEPOINT;
        e_open->attr.config               = 87;
        e_open->attr.size                  = sizeof(e_open->attr);
        e_open->attr.sample_period = 1;
        e_open->attr.inherit               = 1;
        e_open->attr.sample_type     = PERF_SAMPLE_TIME      |

PERF_SAMPLE_RAW       |

PERF_SAMPLE_CPU       |

PERF_SAMPLE_TID       ;
        e_open->attr.__reserved_1       = 0;
        e_open->attr.read_format        = 0;


Running in separate thread for each CPU:
perf_event_open(&e_open->attr,2552,0,-1,0)
perf_event_open(&e_open->attr,2552,1,-1,0)


But if do :

       e_open->attr.disabled           = 1;
        e_open->attr.type                  = PERF_TYPE_SOFTWARE;
        e_open->attr.config               = PERF_COUNT_SW_CONTEXT_SWITCHES;
        e_open->attr.size                  = sizeof(e_open->attr);
        e_open->attr.sample_period = 1;
        e_open->attr.inherit               = 1;
        e_open->attr.sample_type     = PERF_SAMPLE_TIME      |

PERF_SAMPLE_RAW       |

PERF_SAMPLE_CPU       |

PERF_SAMPLE_TID       ;
        e_open->attr.__reserved_1       = 0;
        e_open->attr.read_format          = 0;

It writes events to ring buffer but of course without any
args(prev_comm,prev_pid,next_comm,next_pid)

So i am not able to understand this difference. Why sched:sched_switch
doesnt give me any counter.
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to