projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove glibc < 2.4 compat code for sched_setaffinity
[urcu.git]
/
tests
/
benchmark
/
test_urcu_assign.c
diff --git
a/tests/benchmark/test_urcu_assign.c
b/tests/benchmark/test_urcu_assign.c
index 37b5f7a0c807e4fdba55d4e29b9ee7967bcf79c3..966cf9e56609e269229786d71d6c48a1e861a16c 100644
(file)
--- a/
tests/benchmark/test_urcu_assign.c
+++ b/
tests/benchmark/test_urcu_assign.c
@@
-20,8
+20,6
@@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _GNU_SOURCE
-#include "config.h"
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
@@
-35,7
+33,6
@@
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
-#include "cpuset.h"
#include "thread-id.h"
#include "../common/debug-yield.h"
#include "thread-id.h"
#include "../common/debug-yield.h"
@@
-110,11
+107,7
@@
static void set_affinity(void)
CPU_ZERO(&mask);
CPU_SET(cpu, &mask);
CPU_ZERO(&mask);
CPU_SET(cpu, &mask);
-#if SCHED_SETAFFINITY_ARGS == 2
- sched_setaffinity(0, &mask);
-#else
sched_setaffinity(0, sizeof(mask), &mask);
sched_setaffinity(0, sizeof(mask), &mask);
-#endif
#endif /* HAVE_SCHED_SETAFFINITY */
}
#endif /* HAVE_SCHED_SETAFFINITY */
}
@@
-167,8
+160,8
@@
void rcu_copy_mutex_unlock(void)
* both alloc and free, which insures we never run over our tail.
*/
#define ARRAY_SIZE (1048576 * nr_writers)
* both alloc and free, which insures we never run over our tail.
*/
#define ARRAY_SIZE (1048576 * nr_writers)
-#define ARRAY_POISON 0xDEADBEEF
-static int array_index;
+#define ARRAY_POISON
(int)
0xDEADBEEF
+static
unsigned
int array_index;
static struct test_array *test_array;
static struct test_array *test_array_alloc(void)
static struct test_array *test_array;
static struct test_array *test_array_alloc(void)
@@
-296,6
+289,7
@@
int main(int argc, char **argv)
unsigned long long *count_reader, *count_writer;
unsigned long long tot_reads = 0, tot_writes = 0;
int i, a;
unsigned long long *count_reader, *count_writer;
unsigned long long tot_reads = 0, tot_writes = 0;
int i, a;
+ unsigned int i_thr;
if (argc < 4) {
show_usage(argc, argv);
if (argc < 4) {
show_usage(argc, argv);
@@
-313,7
+307,7
@@
int main(int argc, char **argv)
show_usage(argc, argv);
return -1;
}
show_usage(argc, argv);
return -1;
}
-
+
err = sscanf(argv[3], "%lu", &duration);
if (err != 1) {
show_usage(argc, argv);
err = sscanf(argv[3], "%lu", &duration);
if (err != 1) {
show_usage(argc, argv);
@@
-382,15
+376,15
@@
int main(int argc, char **argv)
next_aff = 0;
next_aff = 0;
- for (i
= 0; i < nr_readers; i
++) {
- err = pthread_create(&tid_reader[i], NULL, thr_reader,
- &count_reader[i]);
+ for (i
_thr = 0; i_thr < nr_readers; i_thr
++) {
+ err = pthread_create(&tid_reader[i
_thr
], NULL, thr_reader,
+ &count_reader[i
_thr
]);
if (err != 0)
exit(1);
}
if (err != 0)
exit(1);
}
- for (i
= 0; i < nr_writers; i
++) {
- err = pthread_create(&tid_writer[i], NULL, thr_writer,
- &count_writer[i]);
+ for (i
_thr = 0; i_thr < nr_writers; i_thr
++) {
+ err = pthread_create(&tid_writer[i
_thr
], NULL, thr_writer,
+ &count_writer[i
_thr
]);
if (err != 0)
exit(1);
}
if (err != 0)
exit(1);
}
@@
-403,19
+397,19
@@
int main(int argc, char **argv)
test_stop = 1;
test_stop = 1;
- for (i
= 0; i < nr_readers; i
++) {
- err = pthread_join(tid_reader[i], &tret);
+ for (i
_thr = 0; i_thr < nr_readers; i_thr
++) {
+ err = pthread_join(tid_reader[i
_thr
], &tret);
if (err != 0)
exit(1);
if (err != 0)
exit(1);
- tot_reads += count_reader[i];
+ tot_reads += count_reader[i
_thr
];
}
}
- for (i
= 0; i < nr_writers; i
++) {
- err = pthread_join(tid_writer[i], &tret);
+ for (i
_thr = 0; i_thr < nr_writers; i_thr
++) {
+ err = pthread_join(tid_writer[i
_thr
], &tret);
if (err != 0)
exit(1);
if (err != 0)
exit(1);
- tot_writes += count_writer[i];
+ tot_writes += count_writer[i
_thr
];
}
}
-
+
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
tot_writes);
printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
tot_writes);
printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
@@
-424,11
+418,13
@@
int main(int argc, char **argv)
argv[0], duration, nr_readers, rduration, wduration,
nr_writers, wdelay, tot_reads, tot_writes,
tot_reads + tot_writes);
argv[0], duration, nr_readers, rduration, wduration,
nr_writers, wdelay, tot_reads, tot_writes,
tot_reads + tot_writes);
+
test_array_free(test_rcu_pointer);
free(test_array);
free(tid_reader);
free(tid_writer);
free(count_reader);
free(count_writer);
test_array_free(test_rcu_pointer);
free(test_array);
free(tid_reader);
free(tid_writer);
free(count_reader);
free(count_writer);
+
return 0;
}
return 0;
}
This page took
0.025533 seconds
and
4
git commands to generate.