From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 9EF3B3835831 for ; Sun, 13 Jun 2021 02:14:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9EF3B3835831 Received: from vapier.lan (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id B1B5A335D08 for ; Sun, 13 Jun 2021 02:14:54 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: rx: replace cycle-stats with common profile settings Date: Sat, 12 Jun 2021 22:14:53 -0400 Message-Id: <20210613021453.8175-1-vapier@gentoo.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jun 2021 02:14:59 -0000 The common sim-profile option controls whether to keep track of runtime execution (like cycle count), so switch the rx-specific cycle-stats option over to that. --- sim/rx/README.txt | 4 ++-- sim/rx/config.in | 3 --- sim/rx/configure | 26 ++------------------------ sim/rx/configure.ac | 17 ----------------- sim/rx/mem.c | 2 +- sim/rx/rx.c | 32 ++++++++++++++++---------------- 6 files changed, 21 insertions(+), 63 deletions(-) diff --git a/sim/rx/README.txt b/sim/rx/README.txt index 496e6a19fb10..5ebd57420839 100644 --- a/sim/rx/README.txt +++ b/sim/rx/README.txt @@ -7,8 +7,8 @@ If enabled, the simulator will keep track of how many cycles each instruction takes. While not 100% accurate, it is very close, including modelling fetch stalls and register latency. ---enable-cycle-stats (default) ---disable-cycle-stats +--enable-sim-profile (default) +--disable-sim-profile If enabled, specifying "-v" twice on the simulator command line causes the simulator to print statistics on how much time was used by each diff --git a/sim/rx/configure.ac b/sim/rx/configure.ac index 5d1076834c1d..b2725fea7976 100644 --- a/sim/rx/configure.ac +++ b/sim/rx/configure.ac @@ -31,27 +31,10 @@ yes | no) ;; *) AC_MSG_ERROR(bad value ${enableval} given for --enable-cycle-accurate option) ;; esac]) -AC_ARG_ENABLE(cycle-stats, -[AS_HELP_STRING([--disable-cycle-stats], - [Disable cycle statistics (faster runtime)])], -[case "${enableval}" in -yes | no) ;; -*) AC_MSG_ERROR(bad value ${enableval} given for --enable-cycle-stats option) ;; -esac]) - echo enable_cycle_accurate is $enable_cycle_accurate -echo enable_cycle_stats is $enable_cycle_stats if test "x${enable_cycle_accurate}" != xno; then AC_DEFINE([CYCLE_ACCURATE], 1, [--enable-cycle-accurate]) - - if test "x${enable_cycle_stats}" != xno; then - AC_DEFINE([CYCLE_STATS], 1, [--enable-cycle-stats]) - fi -else - if test "x${enable_cycle_stats}" != xno; then - AC_ERROR([cycle-stats not available without cycle-accurate]) - fi fi SIM_AC_OUTPUT diff --git a/sim/rx/mem.c b/sim/rx/mem.c index f9b9cc1a97ed..1cbd3587cf71 100644 --- a/sim/rx/mem.c +++ b/sim/rx/mem.c @@ -317,7 +317,7 @@ mem_put_byte (unsigned int address, unsigned char value) } break; -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE case 0x0008c02b: /* PB.DR */ { if (value == 0) diff --git a/sim/rx/rx.c b/sim/rx/rx.c index 869dd3aa89c9..666122792f55 100644 --- a/sim/rx/rx.c +++ b/sim/rx/rx.c @@ -35,7 +35,7 @@ along with this program. If not, see . */ #include "err.h" #include "misc.h" -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE static const char * id_names[] = { "RXO_unknown", "RXO_mov", /* d = s (signed) */ @@ -213,7 +213,7 @@ static int po0; #else #define STATS(x) -#endif /* CYCLE_STATS */ +#endif /* WITH_PROFILE */ #ifdef CYCLE_ACCURATE @@ -424,7 +424,7 @@ get_op (const RX_Opcode_Decoded *rd, int i) if (regs.m2m == M2M_BOTH) { tprintf("src memory stall\n"); -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE memory_stalls ++; #endif regs.cycle_count ++; @@ -594,7 +594,7 @@ put_op (const RX_Opcode_Decoded *rd, int i, int v) { tprintf("dst memory stall\n"); regs.cycle_count ++; -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE memory_stalls ++; #endif regs.m2m = 0; @@ -943,14 +943,14 @@ decode_opcode (void) unsigned long opcode_pc; RX_Data rx_data; const RX_Opcode_Decoded *opcode; -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE unsigned long long prev_cycle_count; #endif #ifdef CYCLE_ACCURATE unsigned int tx; #endif -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE prev_cycle_count = regs.cycle_count; #endif @@ -988,7 +988,7 @@ decode_opcode (void) { tprintf("1 cycle branch alignment penalty\n"); cycles (branch_alignment_penalty); -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE branch_alignment_stalls ++; #endif } @@ -1087,7 +1087,7 @@ decode_opcode (void) cycles (3); branch_alignment_penalty = 1; } -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE branch_stalls ++; #endif #endif @@ -1116,7 +1116,7 @@ decode_opcode (void) cycles (3); branch_alignment_penalty = 1; } -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE branch_stalls ++; #endif #endif @@ -1754,7 +1754,7 @@ decode_opcode (void) /* Note: specs say 5, chip says 3. */ if (regs.fast_return && regs.link_register == regs.r_pc) { -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE fast_returns ++; #endif tprintf("fast return bonus\n"); @@ -1796,7 +1796,7 @@ decode_opcode (void) if (regs.fast_return && regs.link_register == regs.r_pc) { tprintf("fast return bonus\n"); -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE fast_returns ++; #endif cycles (tx < 3 ? 3 : tx + 1); @@ -2172,7 +2172,7 @@ decode_opcode (void) new_rt = -1; #endif -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE if (prev_cycle_count == regs.cycle_count) { printf("Cycle count not updated! id %s\n", id_names[opcode->id]); @@ -2180,7 +2180,7 @@ decode_opcode (void) } #endif -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE if (running_benchmark) { int omap = op_lookup (opcode->op[0].type, opcode->op[1].type, opcode->op[2].type); @@ -2199,7 +2199,7 @@ decode_opcode (void) return RX_MAKE_STEPPED (); } -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE void reset_pipeline_stats (void) { @@ -2227,7 +2227,7 @@ halt_pipeline_stats (void) void pipeline_stats (void) { -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE int i, o1; int p, p1; #endif @@ -2242,7 +2242,7 @@ pipeline_stats (void) printf ("cycles: %13s\n", comma (regs.cycle_count)); #endif -#ifdef CYCLE_STATS +#ifdef WITH_PROFILE if (benchmark_start_cycle) printf ("bmark: %13s\n", comma (benchmark_end_cycle - benchmark_start_cycle)); -- 2.31.1