summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b63efaa)
raw | patch | inline | side by side (parent: b63efaa)
author | Vincent Brillault <git@lerya.net> | |
Thu, 21 Aug 2014 16:05:36 +0000 (18:05 +0200) | ||
committer | Vincent Brillault <git@lerya.net> | |
Sat, 28 Feb 2015 06:35:40 +0000 (07:35 +0100) |
src/turbostat.c | patch | blob | history |
diff --git a/src/turbostat.c b/src/turbostat.c
index 96cb137aede372e2065a9b501b70baba1ea25958..ad60f3138988c3ea80d12a4827fd01ef03a05658 100644 (file)
--- a/src/turbostat.c
+++ b/src/turbostat.c
#include <asm/msr-index.h>
#include <stdarg.h>
#include <stdio.h>
-#include <stdbool.h>
#include <err.h>
#include <unistd.h>
#include <sys/types.h>
#define ODD_COUNTERS thread_odd, core_odd, package_odd
#define EVEN_COUNTERS thread_even, core_even, package_even
-static bool is_even = true;
+static _Bool is_even = 1;
-static bool allocated = false;
-static bool initialized = false;
+static _Bool allocated = 0;
+static _Bool initialized = 0;
#define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \
(thread_base + (pkg_no) * topo.num_cores_per_pkg * \
static void
free_all_buffers(void)
{
- allocated = false;
- initialized = false;
+ allocated = 0;
+ initialized = 0;
CPU_FREE(cpu_present_set);
cpu_present_set = NULL;
if ((ret = for_all_cpus(get_counters, EVEN_COUNTERS)) < 0)
return ret;
gettimeofday(&tv_even, (struct timezone *)NULL);
- is_even = true;
- initialized = true;
+ is_even = 1;
+ initialized = 1;
return 0;
}
if ((ret = for_all_cpus(get_counters, ODD_COUNTERS)) < 0)
return ret;
gettimeofday(&tv_odd, (struct timezone *)NULL);
- is_even = false;
+ is_even = 0;
timersub(&tv_odd, &tv_even, &tv_delta);
if ((ret = for_all_cpus_2(delta_cpu, ODD_COUNTERS, EVEN_COUNTERS)) < 0)
return ret;
if ((ret = for_all_cpus(get_counters, EVEN_COUNTERS)) < 0)
return ret;
gettimeofday(&tv_even, (struct timezone *)NULL);
- is_even = true;
+ is_even = 1;
timersub(&tv_even, &tv_odd, &tv_delta);
if ((ret = for_all_cpus_2(delta_cpu, EVEN_COUNTERS, ODD_COUNTERS)) < 0)
return ret;
DO_OR_GOTO_ERR(allocate_counters(&thread_odd, &core_odd, &package_odd));
DO_OR_GOTO_ERR(for_all_proc_cpus(initialize_counters));
- allocated = true;
+ allocated = 1;
return 0;
err:
free_all_buffers();