Skip to content
Snippets Groups Projects
Commit 4be9b828 authored by Georges Da Costa's avatar Georges Da Costa
Browse files

On the way to make it build on g++

parent 04364bb7
No related branches found
No related tags found
1 merge request!12Libmoj
Pipeline #11551 failed
...@@ -71,8 +71,8 @@ struct optparse_long { ...@@ -71,8 +71,8 @@ struct optparse_long {
const char *longname; const char *longname;
int shortname; int shortname;
enum optparse_argtype argtype; enum optparse_argtype argtype;
char *usage_arg; const char *usage_arg;
char *usage_msg; const char *usage_msg;
void *(*fn)(void *, size_t); /* SUBJECT TO CHANGE */ void *(*fn)(void *, size_t); /* SUBJECT TO CHANGE */
}; };
......
...@@ -11,8 +11,11 @@ BIN = mojitos ...@@ -11,8 +11,11 @@ BIN = mojitos
BINP = mojitos_prometeus BINP = mojitos_prometeus
PREFIX = /usr/local PREFIX = /usr/local
CC = gcc # CC = g++
# CPPFLAGS = -std=c++20 -Wall -Wextra -Wpedantic -Wno-unused-function -I./lib $(NVML_IFLAGS)
CC = clang
CPPFLAGS = -std=gnu99 -Wall -Wextra -Wpedantic -Wno-unused-function -I./lib $(NVML_IFLAGS) CPPFLAGS = -std=gnu99 -Wall -Wextra -Wpedantic -Wno-unused-function -I./lib $(NVML_IFLAGS)
CFLAGS = $(CPPFLAGS) -O3 -Werror CFLAGS = $(CPPFLAGS) -O3 -Werror
LDFLAGS = $(CAPTOR_LDFLAGS) LDFLAGS = $(CAPTOR_LDFLAGS)
......
...@@ -41,6 +41,7 @@ Optparse counters_opt[2] = { ...@@ -41,6 +41,7 @@ Optparse counters_opt[2] = {
.usage_msg = "performance counters\n" .usage_msg = "performance counters\n"
"\tperf_list is a coma separated list of performance counters.\n" "\tperf_list is a coma separated list of performance counters.\n"
"\tEx: instructions,cache_misses", "\tEx: instructions,cache_misses",
.fn = NULL,
}, },
{ {
.longname = "list", .longname = "list",
......
...@@ -49,24 +49,24 @@ void add_source(Sensor *cpt, char *arg) ...@@ -49,24 +49,24 @@ void add_source(Sensor *cpt, char *arg)
getter_t get = cpt->get; getter_t get = cpt->get;
cleaner_t clean = cpt->clean; cleaner_t clean = cpt->clean;
states = realloc(states, nb_sources * sizeof(void *)); states = (void**) realloc(states, nb_sources * sizeof(void *));
int nb = init(arg, &states[nb_sources - 1]); int nb = init(arg, &states[nb_sources - 1]);
if (nb == 0) { if (nb == 0) {
nb_sources--; nb_sources--;
states = realloc(states, nb_sources * sizeof(void *)); states = (void**) realloc(states, nb_sources * sizeof(void *));
return; return;
} }
getter = realloc(getter, nb_sources * sizeof(void *)); getter = (getter_t*) realloc(getter, nb_sources * sizeof(void *));
getter[nb_sources - 1] = get; getter[nb_sources - 1] = get;
cleaner = realloc(cleaner, nb_sources * sizeof(void *)); cleaner = (cleaner_t*) realloc(cleaner, nb_sources * sizeof(void *));
cleaner[nb_sources - 1] = clean; cleaner[nb_sources - 1] = clean;
labels = realloc(labels, (nb_sensors + nb) * sizeof(char *)); labels = (char**) realloc(labels, (nb_sensors + nb) * sizeof(char *));
labeler(labels + nb_sensors, states[nb_sources - 1]); labeler(labels + nb_sensors, states[nb_sources - 1]);
values = realloc(values, (nb_sensors + nb) * sizeof(uint64_t)); values = (uint64_t*) realloc(values, (nb_sensors + nb) * sizeof(uint64_t));
nb_sensors += nb; nb_sensors += nb;
} }
......
...@@ -41,6 +41,7 @@ Optparse likwid_opt[2] = { ...@@ -41,6 +41,7 @@ Optparse likwid_opt[2] = {
.usage_msg = "performance counters\n" .usage_msg = "performance counters\n"
"\tperf_list is a coma separated list of performance counters with associated register.\n" "\tperf_list is a coma separated list of performance counters with associated register.\n"
"\tEx: FP_ARITH_INST_RETIRED_128B_PACKED_DOUBLE:PMC0,FP_ARITH_INST_RETIRED_SCALAR_DOUBLE:PMC1", "\tEx: FP_ARITH_INST_RETIRED_128B_PACKED_DOUBLE:PMC0,FP_ARITH_INST_RETIRED_SCALAR_DOUBLE:PMC1",
.fn = NULL,
}, },
{ {
.longname = "list-likwid", .longname = "list-likwid",
......
...@@ -38,5 +38,6 @@ Optparse load_opt[1] = { ...@@ -38,5 +38,6 @@ Optparse load_opt[1] = {
.argtype = OPTPARSE_NONE, .argtype = OPTPARSE_NONE,
.usage_arg = NULL, .usage_arg = NULL,
.usage_msg = "system load", .usage_msg = "system load",
.fn = NULL,
}, },
}; };
...@@ -39,5 +39,6 @@ Optparse memory_opt[1] = { ...@@ -39,5 +39,6 @@ Optparse memory_opt[1] = {
.argtype = OPTPARSE_NONE, .argtype = OPTPARSE_NONE,
.usage_arg = NULL, .usage_arg = NULL,
.usage_msg = "Retrieves information about the memory via the syscall 'sysinfo(2)'.", .usage_msg = "Retrieves information about the memory via the syscall 'sysinfo(2)'.",
.fn = NULL,
}, },
}; };
...@@ -75,7 +75,7 @@ unsigned int init_memory_counters(char *args, void **ptr) ...@@ -75,7 +75,7 @@ unsigned int init_memory_counters(char *args, void **ptr)
KeyFinder *keys = build_keyfinder(count, indexes); KeyFinder *keys = build_keyfinder(count, indexes);
FILE *file = fopen(path, "r"); FILE *file = fopen(path, "r");
MemoryCounters *counters = calloc(1, sizeof(MemoryCounters)); MemoryCounters *counters = (MemoryCounters *) calloc(1, sizeof(MemoryCounters));
counters->keys = keys; counters->keys = keys;
counters->count = count; counters->count = count;
counters->file = file; counters->file = file;
......
...@@ -42,6 +42,7 @@ Optparse memory_counters_opt[2] = { ...@@ -42,6 +42,7 @@ Optparse memory_counters_opt[2] = {
"memory counters\n" "memory counters\n"
"\tmemory_list is a coma separated list of memory counters.\n" "\tmemory_list is a coma separated list of memory counters.\n"
"\tEx: Zswap,Zswapped", "\tEx: Zswap,Zswapped",
.fn = NULL,
}, },
{ {
.longname = "memory-list", .longname = "memory-list",
......
...@@ -38,5 +38,6 @@ Optparse network_opt[1] = { ...@@ -38,5 +38,6 @@ Optparse network_opt[1] = {
.argtype = OPTPARSE_REQUIRED, .argtype = OPTPARSE_REQUIRED,
.usage_arg = "<net_dev>", .usage_arg = "<net_dev>",
.usage_msg = "network monitoring (if network_device is X, tries to detect it automatically)", .usage_msg = "network monitoring (if network_device is X, tries to detect it automatically)",
.fn = NULL,
}, },
}; };
...@@ -38,6 +38,7 @@ Optparse rapl_opt[1] = { ...@@ -38,6 +38,7 @@ Optparse rapl_opt[1] = {
.argtype = OPTPARSE_NONE, .argtype = OPTPARSE_NONE,
.usage_arg = NULL, .usage_arg = NULL,
.usage_msg = "INTEL RAPL (micro-joules)", .usage_msg = "INTEL RAPL (micro-joules)",
.fn = NULL,
}, },
}; };
...@@ -37,6 +37,7 @@ Optparse temperature_opt[1] = { ...@@ -37,6 +37,7 @@ Optparse temperature_opt[1] = {
.shortname = 'c', .shortname = 'c',
.argtype = OPTPARSE_NONE, .argtype = OPTPARSE_NONE,
.usage_arg = NULL, .usage_arg = NULL,
.usage_msg = "processor temperature" .usage_msg = "processor temperature",
.fn = NULL,
}, },
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment