diff options
author | Christopher Head <chead@zaber.com> | 2018-01-24 14:35:40 -0800 |
---|---|---|
committer | Freddie Chopin <freddie.chopin@gmail.com> | 2018-01-25 16:43:49 +0000 |
commit | 2428722a23d8a08b15331ab95884762e5f329a02 (patch) | |
tree | 1cb2324b2c7b02945369b53c5704ad936969e824 /src/target/openrisc | |
parent | e0fc7a54f287aad414b373410e09faa048f3a9dd (diff) | |
download | riscv-openocd-2428722a23d8a08b15331ab95884762e5f329a02.zip riscv-openocd-2428722a23d8a08b15331ab95884762e5f329a02.tar.gz riscv-openocd-2428722a23d8a08b15331ab95884762e5f329a02.tar.bz2 |
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>
Diffstat (limited to 'src/target/openrisc')
-rw-r--r-- | src/target/openrisc/or1k.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/target/openrisc/or1k.c b/src/target/openrisc/or1k.c index 3895ddf..bcb648c 100644 --- a/src/target/openrisc/or1k.c +++ b/src/target/openrisc/or1k.c @@ -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; } |