A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update XBT_ATTRIB_DEPRECATED_v??? in comments.
[simgrid.git]
/
teshsuite
/
smpi
/
timers
/
timers.c
diff --git
a/teshsuite/smpi/timers/timers.c
b/teshsuite/smpi/timers/timers.c
index 18ff5d89c5064d32258a8ec64dba7a48480767d7..53100712ffbaffa7082a327316ed3360f81d6430 100644
(file)
--- a/
teshsuite/smpi/timers/timers.c
+++ b/
teshsuite/smpi/timers/timers.c
@@
-1,3
+1,8
@@
+/* Copyright (c) 2016-2023. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
@@
-28,7
+33,7
@@
int main(int argc, char* argv[])
gettimeofday(&tv1, NULL);
sleep(1);
gettimeofday(&tv2, NULL);
gettimeofday(&tv1, NULL);
sleep(1);
gettimeofday(&tv2, NULL);
- long res = (
(tv2.tv_sec * 1000000 + tv2.tv_usec)) - ((tv1.tv_sec * 1000000 + tv1.tv_usec)
);
+ long res = (
tv2.tv_sec * 1000000 + tv2.tv_usec) - (tv1.tv_sec * 1000000 + tv1.tv_usec
);
if (res < 999998 || res > 1000002)
printf("Error, sleep(1) did not exactly slept 1s\n");
if (res < 999998 || res > 1000002)
printf("Error, sleep(1) did not exactly slept 1s\n");
@@
-36,7
+41,7
@@
int main(int argc, char* argv[])
gettimeofday(&tv1, NULL);
usleep(100);
gettimeofday(&tv2, NULL);
gettimeofday(&tv1, NULL);
usleep(100);
gettimeofday(&tv2, NULL);
- res = (
(tv2.tv_sec * 1000000 + tv2.tv_usec)) - ((tv1.tv_sec * 1000000 + tv1.tv_usec)
);
+ res = (
tv2.tv_sec * 1000000 + tv2.tv_usec) - (tv1.tv_sec * 1000000 + tv1.tv_usec
);
if (res < 98 || res > 102)
printf("Error, usleep did not really sleep 100us, but %ld\n", res);
if (res < 98 || res > 102)
printf("Error, usleep did not really sleep 100us, but %ld\n", res);
@@
-48,8
+53,8
@@
int main(int argc, char* argv[])
struct timespec tpsleep;
clock_gettime(CLOCK_REALTIME, &tp1);
clock_gettime(CLOCK_REALTIME, &tp2);
struct timespec tpsleep;
clock_gettime(CLOCK_REALTIME, &tp1);
clock_gettime(CLOCK_REALTIME, &tp2);
- if (
(tp1.tv_sec != tp2.tv_sec) || (tp1.tv_nsec != tp2.tv_nsec)
)
- printf("Error, two consecutive calls to
gettimeofday
did not return same time (with running power to 0)\n");
+ if (
tp1.tv_sec != tp2.tv_sec || tp1.tv_nsec != tp2.tv_nsec
)
+ printf("Error, two consecutive calls to
clock_gettime
did not return same time (with running power to 0)\n");
// nanosleep for 100ns
clock_gettime(CLOCK_REALTIME, &tp1);
// nanosleep for 100ns
clock_gettime(CLOCK_REALTIME, &tp1);
@@
-57,7
+62,7
@@
int main(int argc, char* argv[])
tpsleep.tv_nsec = 100;
nanosleep(&tpsleep, NULL);
clock_gettime(CLOCK_REALTIME, &tp2);
tpsleep.tv_nsec = 100;
nanosleep(&tpsleep, NULL);
clock_gettime(CLOCK_REALTIME, &tp2);
- res = (
(tp2.tv_sec * 1000000000 + tp2.tv_nsec)) - ((tp1.tv_sec * 1000000000 + tp1.tv_nsec)
);
+ res = (
tp2.tv_sec * 1000000000 + tp2.tv_nsec) - (tp1.tv_sec * 1000000000 + tp1.tv_nsec
);
if (res < 98 || res > 102)
printf("Error, nanosleep did not really sleep 100ns, but %ld\n", res);
#endif
if (res < 98 || res > 102)
printf("Error, nanosleep did not really sleep 100ns, but %ld\n", res);
#endif