From 3462b4d7ec34c91c9cd7adcfc3c3ef21a4c20b00 Mon Sep 17 00:00:00 2001 From: Georges Da Costa <dacosta@irit.fr> Date: Sat, 27 Nov 2021 16:22:19 +0100 Subject: [PATCH] Adds new counters and update performance counters with reads, pending, missing, ... see -l --- counters_group.c | 2 +- counters_individual.c | 3 +-- counters_option.py | 23 ++++++++++++++++++++--- infiniband.c | 2 +- load.c | 2 +- makefile | 4 ++-- 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/counters_group.c b/counters_group.c index 22017c9..bc9b448 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 79533ff..1437aa3 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 f3f2df2..877a33a 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 318a9e4..95d222e 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 10c90d0..b3d154d 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 a383614..3c527d5 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 -- GitLab