Use timeval helpers
Some of these changes actually fix broken comparisons which could occasionally fail. Others just clean up the code and make it more clear. Change-Id: I6c398bdc45fa0d2716f48a74822457d1351f81a5 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4380 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
committed by
Freddie Chopin
parent
e0fc7a54f2
commit
2428722a23
@@ -1248,8 +1248,7 @@ static int or1k_profiling(struct target *target, uint32_t *samples,
|
||||
samples[sample_count++] = reg_value;
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
if ((sample_count >= max_num_samples) ||
|
||||
((now.tv_sec >= timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec))) {
|
||||
if ((sample_count >= max_num_samples) || timeval_compare(&now, &timeout) > 0) {
|
||||
LOG_INFO("Profiling completed. %" PRIu32 " samples.", sample_count);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user