summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/introspective-cputime.c8
-rw-r--r--tests/introspective-system.c8
-rw-r--r--tests/monotonic-cputime.c8
-rw-r--r--tests/monotonic-realticks.c8
-rw-r--r--tests/monotonic-system.c8
5 files changed, 10 insertions, 30 deletions
diff --git a/tests/introspective-cputime.c b/tests/introspective-cputime.c
index 026ae94..b35e2f4 100644
--- a/tests/introspective-cputime.c
+++ b/tests/introspective-cputime.c
@@ -30,18 +30,14 @@ main()
{
sandglass_t sandglass;
sandglass_attributes_t attr = { SANDGLASS_INTROSPECTIVE, SANDGLASS_CPUTIME };
- struct timespec tosleep;
+ struct timespec tosleep = { .tv_sec = 0, .tv_nsec = 100000000L };
if (sandglass_create(&sandglass, &attr, &attr) != 0) {
perror("sandglass_create()");
return EXIT_FAILURE;
}
- sandglass_bench(&sandglass, {
- tosleep.tv_sec = 0;
- tosleep.tv_nsec = 100000000L;
- sandglass_spin(&tosleep);
- });
+ sandglass_bench(&sandglass, sandglass_spin(&tosleep));
printf("%g\n", sandglass.grains/sandglass.resolution);
diff --git a/tests/introspective-system.c b/tests/introspective-system.c
index 21ffa4c..beb799f 100644
--- a/tests/introspective-system.c
+++ b/tests/introspective-system.c
@@ -30,18 +30,14 @@ main()
{
sandglass_t sandglass;
sandglass_attributes_t attr = { SANDGLASS_INTROSPECTIVE, SANDGLASS_SYSTEM };
- struct timespec tosleep;
+ struct timespec tosleep = { .tv_sec = 0, .tv_nsec = 100000000L };
if (sandglass_create(&sandglass, &attr, &attr) != 0) {
perror("sandglass_create()");
return EXIT_FAILURE;
}
- sandglass_bench(&sandglass, {
- tosleep.tv_sec = 0;
- tosleep.tv_nsec = 100000000L;
- sandglass_spin(&tosleep);
- });
+ sandglass_bench(&sandglass, sandglass_spin(&tosleep));
printf("%g\n", sandglass.grains/sandglass.resolution);
diff --git a/tests/monotonic-cputime.c b/tests/monotonic-cputime.c
index 7e0fdef..4d56793 100644
--- a/tests/monotonic-cputime.c
+++ b/tests/monotonic-cputime.c
@@ -30,18 +30,14 @@ main()
{
sandglass_t sandglass;
sandglass_attributes_t attr = { SANDGLASS_MONOTONIC, SANDGLASS_CPUTIME };
- struct timespec tosleep;
+ struct timespec tosleep = { .tv_sec = 0, .tv_nsec = 100000000L };
if (sandglass_create(&sandglass, &attr, &attr) != 0) {
perror("sandglass_create()");
return EXIT_FAILURE;
}
- sandglass_bench(&sandglass, {
- tosleep.tv_sec = 0;
- tosleep.tv_nsec = 100000000L;
- sandglass_spin(&tosleep);
- });
+ sandglass_bench(&sandglass, sandglass_spin(&tosleep));
printf("%g\n", sandglass.grains/sandglass.resolution);
diff --git a/tests/monotonic-realticks.c b/tests/monotonic-realticks.c
index 5cadd1d..c548f18 100644
--- a/tests/monotonic-realticks.c
+++ b/tests/monotonic-realticks.c
@@ -30,18 +30,14 @@ main()
{
sandglass_t sandglass;
sandglass_attributes_t attr = { SANDGLASS_MONOTONIC, SANDGLASS_REALTICKS };
- struct timespec tosleep;
+ struct timespec tosleep = { .tv_sec = 0, .tv_nsec = 100000000L };
if (sandglass_create(&sandglass, &attr, &attr) != 0) {
perror("sandglass_create()");
return EXIT_FAILURE;
}
- sandglass_bench(&sandglass, {
- tosleep.tv_sec = 0;
- tosleep.tv_nsec = 100000000L;
- sandglass_spin(&tosleep);
- });
+ sandglass_bench(&sandglass, sandglass_spin(&tosleep));
printf("%g\n", sandglass.grains/sandglass.resolution);
diff --git a/tests/monotonic-system.c b/tests/monotonic-system.c
index 49a1b8c..3c8e9be 100644
--- a/tests/monotonic-system.c
+++ b/tests/monotonic-system.c
@@ -30,18 +30,14 @@ main()
{
sandglass_t sandglass;
sandglass_attributes_t attr = { SANDGLASS_MONOTONIC, SANDGLASS_SYSTEM };
- struct timespec tosleep;
+ struct timespec tosleep = { .tv_sec = 0, .tv_nsec = 100000000L };
if (sandglass_create(&sandglass, &attr, &attr) != 0) {
perror("sandglass_create()");
return EXIT_FAILURE;
}
- sandglass_bench(&sandglass, {
- tosleep.tv_sec = 0;
- tosleep.tv_nsec = 100000000L;
- sandglass_spin(&tosleep);
- });
+ sandglass_bench(&sandglass, sandglass_spin(&tosleep));
printf("%g\n", sandglass.grains/sandglass.resolution);