aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/bench_loop.c
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2018-08-24 22:15:32 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2018-08-24 22:15:32 +0200
commit933592db4782b0fe155231f805e017330efd5f65 (patch)
tree95f0a128a5c846db7a4c9b8a354133776d78f6b0 /benchmarks/bench_loop.c
parent423cc4f28dc7fbf86ee951a22b7c69cfe3d0131c (diff)
downloadallocbench-933592db4782b0fe155231f805e017330efd5f65.tar.gz
allocbench-933592db4782b0fe155231f805e017330efd5f65.zip
use new memusage gathering in loop
Diffstat (limited to 'benchmarks/bench_loop.c')
-rw-r--r--benchmarks/bench_loop.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/benchmarks/bench_loop.c b/benchmarks/bench_loop.c
index ecfa5d6..af7ff10 100644
--- a/benchmarks/bench_loop.c
+++ b/benchmarks/bench_loop.c
@@ -77,8 +77,8 @@ int main(int argc, char* argv[]) {
int num_threads;
struct ThreadArgs thread_args;
- if (argc < 7) {
- fprintf(stderr, "Usage: %s <benchmark> <num threads> <num allocations> <max size> <num of stored allocations> <print mem stats> [<output-file>]\n", argv[0]);
+ if (argc < 6) {
+ fprintf(stderr, "Usage: %s <benchmark> <num threads> <num allocations> <max size> <num of stored allocations>\n", argv[0]);
return 1;
}
@@ -104,34 +104,14 @@ int main(int argc, char* argv[]) {
}
}
- if (strcmp(argv[6], "yes") == 0)
+ if (argc == 7)
{
- char buf[4096];
-
- FILE* status = fopen("/proc/self/status", "r");
- if (status == NULL)
- {
- perror("fopen status");
- exit(1);
- }
-
- FILE* output = stdout;
- if (argc == 8)
- {
- output = fopen(argv[7], "w");
- if (output == NULL)
- {
- perror("fopen output file");
- exit(1);
- }
- }
-
- while (!feof(status))
- {
- fgets(&buf, 4096, status);
- fprintf(output, "%s", buf);
- }
- fclose(status);
+ FILE* f = stdout;
+ if (strcmp(argv[6],"stdout") != 0)
+ f = fopen(argv[6], "w");
+ malloc_info(0, f);
+ if (strcmp(argv[6],"stdout") != 0)
+ fclose(f);
}
return 0;