Li, Aubrey wrote:
>
> Sorry, I didn't catch your point. We have only one probe, from which we
> only have a timestamp.
> Next time the probe fired, the key of the association is changed. 
> How to track an interval between the first time and the second time of
> the association with the same key?
>   
I guess you need to track the old state and time for the CPU. I think 
you can do that in some
associative arrays:

::cpu_change_speed
{
...
    this->cpu = (processorid_t)arg1;         /* arg1 == CPU for which we 
are changing speed */
    this->newspd = (uint_t)arg2;              /* arg2 == New speed */

    this->oldspd = current_speeds[this->cpu];
    current_speeds[this->cpu] = this->newspd;

    this->now = timestamp;
    time_at_speed = this->now - state_times[this->cpu];
    state_times[this->cpu] = this->now;

    @pstate_times[this->oldspd, this->cpu] = sum(time_at_speed);
}

... or to get aggregate times (across all CPUs) I think you should be 
able to do:

    @pstate_times[this->oldspd] = sum(time_at_speed);

Thanks,
-Eric

Reply via email to