--- hatari/src/debug/profile.c 2019/04/09 08:54:24 1.1.1.4 +++ hatari/src/debug/profile.c 2019/04/09 08:55:36 1.1.1.5 @@ -1,7 +1,7 @@ /* * Hatari - profile.c * - * Copyright (C) 2010-2013 by Eero Tamminen + * Copyright (C) 2010-2015 by Eero Tamminen * * This file is distributed under the GNU General Public License, version 2 * or at your option any later version. Read the file gpl.txt for details. @@ -72,9 +72,10 @@ static bool output_counter_info(FILE *fp */ fprintf(fp, " %"PRIu64"/%"PRIu64"/%"PRIu64"", counter->calls, counter->count, counter->cycles); - if (counter->misses) { + if (counter->i_misses) { /* these are only with specific WinUAE CPU core */ - fprintf(fp, "/%"PRIu64"", counter->misses); + fprintf(fp, "/%"PRIu64"/%"PRIu64"", + counter->i_misses, counter->d_hits); } return true; } @@ -130,7 +131,7 @@ void Profile_ShowCallers(FILE *fp, int s for (i = 0; i < ARRAYSIZE(flaginfo); i++) { fprintf(fp, "%c = %s, ", flaginfo[i].chr, flaginfo[i].info); } - fputs("\n# totals: calls/instructions/cycles/misses\n", fp); + fputs("\n# totals: calls/instructions/cycles/i-misses/d-hits\n", fp); countdiff = 0; countissues = 0; @@ -189,7 +190,8 @@ static void add_counter_costs(counters_t dst->calls += src->calls; dst->count += src->count; dst->cycles += src->cycles; - dst->misses += src->misses; + dst->i_misses += src->i_misses; + dst->d_hits += src->d_hits; } /** @@ -200,7 +202,8 @@ static void set_counter_diff(counters_t dst->calls = ref->calls - dst->calls; dst->count = ref->count - dst->count; dst->cycles = ref->cycles - dst->cycles; - dst->misses = ref->misses - dst->misses; + dst->i_misses = ref->i_misses - dst->i_misses; + dst->d_hits = ref->d_hits - dst->d_hits; } /** @@ -496,8 +499,8 @@ void Profile_FreeCallinfo(callinfo_t *ca char *Profile_Match(const char *text, int state) { static const char *names[] = { - "addresses", "callers", "counts", "cycles", "loops", "misses", - "off", "on", "save", "stack", "stats", "symbols" + "addresses", "callers", "caches", "counts", "cycles", "d-hits", "i-misses", + "loops", "off", "on", "save", "stack", "stats", "symbols" }; return DebugUI_MatchHelper(names, ARRAYSIZE(names), text, state); } @@ -510,10 +513,12 @@ const char Profile_Description[] = "\t- off\n" "\t- counts [count]\n" "\t- cycles [count]\n" - "\t- misses [count]\n" + "\t- i-misses [count]\n" + "\t- d-hits [count]\n" "\t- symbols [count]\n" "\t- addresses [address]\n" "\t- callers\n" + "\t- caches\n" "\t- stack\n" "\t- stats\n" "\t- save \n" @@ -524,9 +529,11 @@ const char Profile_Description[] = "\tstatistics ('stats') summary.\n" "\n" "\tThen you can ask for list of the PC addresses, sorted either by\n" - "\texecution 'counts', used 'cycles' or cache 'misses'. First can\n" - "\tbe limited just to named addresses with 'symbols'. Optional\n" - "\tcount will limit how many items will be shown.\n" + "\texecution 'counts', used 'cycles', i-cache misses or d-cache hits.\n" + "\tFirst can be limited just to named addresses with 'symbols'.\n" + "\tOptional count will limit how many items will be shown.\n" + "\n" + "'caches' shows histogram of CPU cache usage.\n" "\n" "\t'addresses' lists the profiled addresses in order, with the\n" "\tinstructions (currently) residing at them. By default this\n" @@ -691,11 +698,23 @@ int Profile_Command(int nArgc, char *psA } else { Profile_CpuShowStats(); } - } else if (strcmp(psArgs[1], "misses") == 0) { + } else if (strcmp(psArgs[1], "i-misses") == 0) { + if (bForDsp) { + fprintf(stderr, "Cache information is recorded only for CPU, not DSP.\n"); + } else { + Profile_CpuShowInstrMisses(show); + } + } else if (strcmp(psArgs[1], "d-hits") == 0) { + if (bForDsp) { + fprintf(stderr, "Cache information is recorded only for CPU, not DSP.\n"); + } else { + Profile_CpuShowDataHits(show); + } + } else if (strcmp(psArgs[1], "caches") == 0) { if (bForDsp) { - fprintf(stderr, "Cache misses are recorded only for CPU, not DSP.\n"); + fprintf(stderr, "Cache information is recorded only for CPU, not DSP.\n"); } else { - Profile_CpuShowMisses(show); + Profile_CpuShowCaches(); } } else if (strcmp(psArgs[1], "cycles") == 0) { if (bForDsp) {