aboutsummaryrefslogtreecommitdiff
path: root/src/target/openrisc
diff options
context:
space:
mode:
authorChristopher Head <chead@zaber.com>2018-01-24 14:35:40 -0800
committerFreddie Chopin <freddie.chopin@gmail.com>2018-01-25 16:43:49 +0000
commit2428722a23d8a08b15331ab95884762e5f329a02 (patch)
tree1cb2324b2c7b02945369b53c5704ad936969e824 /src/target/openrisc
parente0fc7a54f287aad414b373410e09faa048f3a9dd (diff)
downloadriscv-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.c3
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;
}