diff --git a/counters_group.c b/counters_group.c index 22017c98fe3472d1057a469d1725c40dfc010976..bc9b448f818df565565416077a9d5788cfbadf62 100644 --- a/counters_group.c +++ b/counters_group.c @@ -1,5 +1,5 @@ /******************************************************* - Copyright (C) 2018-2019 Georges Da Costa <georges.da-costa@irit.fr> + Copyright (C) 2018-2021 Georges Da Costa <georges.da-costa@irit.fr> This file is part of Mojitos. diff --git a/counters_individual.c b/counters_individual.c index 79533ff756fc5f5ec92780748757451ebea2d922..1437aa38442230ae0196dbb14e63c13a81c7b6d9 100644 --- a/counters_individual.c +++ b/counters_individual.c @@ -1,5 +1,5 @@ /******************************************************* - Copyright (C) 2018-2019 Georges Da Costa <georges.da-costa@irit.fr> + Copyright (C) 2018-2021 Georges Da Costa <georges.da-costa@irit.fr> This file is part of Mojitos. @@ -45,7 +45,6 @@ typedef struct _counter_t* counter_t; void show_all_counters() { for(int i=0; i<nb_counter_option;i++) printf("%s\n", perf_static_info[i].name); - } void perf_type_key(__u32 **perf_type, __u64 **perf_key, int *indexes, int nb){ diff --git a/counters_option.py b/counters_option.py index f3f2df27d706c0fddc6dd097664de144a773066b..877a33afbd61814acf3ddbb4c5311bd043c4ef37 100755 --- a/counters_option.py +++ b/counters_option.py @@ -35,9 +35,26 @@ with open(linux_include, 'r') as infile: short_perf = perf_name[14:].lower() if short_perf in black_list: continue - res = '{ .name = "'+short_perf+'", .perf_type = '+mode+', .perf_key = '+perf_name+'},' - print(res) - nb += 1 + if mode == 'PERF_TYPE_HW_CACHE': + for op_id, op_id_str in enumerate(['r', 'w', 'p']): + op_id_names = ['PERF_COUNT_HW_CACHE_OP_READ', 'PERF_COUNT_HW_CACHE_OP_WRITE', 'PERF_COUNT_HW_CACHE_OP_PREFETCH'] + for result_id, result_id_str in enumerate(['a', 'm']): + result_id_names = ['PERF_COUNT_HW_CACHE_RESULT_ACCESS', 'PERF_COUNT_HW_CACHE_RESULT_MISS'] + + res = '{ .name = "%s_%s_%s", .perf_type = %s, .perf_key = %s | (%s >> 8) | (%s >> 16) },' % ( + short_perf, op_id_str, result_id_str, + mode, + perf_name, + op_id_names[op_id], + result_id_names[result_id]) + + print(res) + nb += 1 + + else: + res = '{ .name = "'+short_perf+'", .perf_type = '+mode+', .perf_key = '+perf_name+'},' + print(res) + nb += 1 print('};') diff --git a/infiniband.c b/infiniband.c index 318a9e4f0a9f1b8051454bdd4c455b8a0b80e9ca..95d222e1db8a8fc1ba462e0aad2f462c3814baa7 100644 --- a/infiniband.c +++ b/infiniband.c @@ -1,5 +1,5 @@ /******************************************************* - Copyright (C) 2018-2020 Georges Da Costa <georges.da-costa@irit.fr> + Copyright (C) 2018-2021 Georges Da Costa <georges.da-costa@irit.fr> This file is part of Mojitos. diff --git a/load.c b/load.c index 10c90d0b09cd0f4465176608573863dd25639cfe..b3d154d794c35f96baeb64ae61d447400633cbc0 100644 --- a/load.c +++ b/load.c @@ -1,5 +1,5 @@ /******************************************************* - Copyright (C) 2019-2020 Georges Da Costa <georges.da-costa@irit.fr> + Copyright (C) 2019-2021 Georges Da Costa <georges.da-costa@irit.fr> This file is part of Mojitos. diff --git a/makefile b/makefile index a383614961e467e5561d149f973f1c39afcc050c..3c527d5906d28aa0a306c79e0f9f02ca2083b400 100644 --- a/makefile +++ b/makefile @@ -2,14 +2,14 @@ all: mojitos OBJECTS = mojitos.o counters_individual.o rapl.o network.o load.o infiniband.o temperature.o -mojitos:$(OBJECTS) counters_option.h +mojitos:$(OBJECTS) gcc $(DEBUG) -O3 -Wall -o mojitos $(OBJECTS) -lpowercap OBJECTS_GRP = $(subst _individual,_group, $(OBJECTS)) mojitos_group: $(OBJECTS_GRP) counters_option.h gcc $(DEBUG) -O3 -Wall -o mojitos_group $(OBJECTS_GRP) -lpowercap -counters_%.o: counters_%.c counters.h +counters_%.o: counters_%.c counters.h counters_option.h gcc $(DEBUG) -c -O3 -Wall $< -o $@ counters_option.h: counters_option.py