If the clock_index isn't non-zero, it's not valid and we should disregard
the sample. Ditto if an exit signal has been sent, we're done at that
point and aren't interested in the last samples.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
unsigned long cycles;
unsigned int pidx;
- cycles = get_cpu_clock();
- cycles -= s->clock_batch[clock_index];
- pidx = plat_val_to_idx(cycles);
- s->plat[pidx] += nr;
+ if (!s->finish && clock_index) {
+ cycles = get_cpu_clock();
+ cycles -= s->clock_batch[clock_index];
+ pidx = plat_val_to_idx(cycles);
+ s->plat[pidx] += nr;
+ }
#endif
}