aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-07-12 11:10:26 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-07-12 11:10:26 -0700
commitd88671efdfd08f5fcb33b4c4099d79eb82978c62 (patch)
tree7b9d7acaf54b4f907def6ef5eb2f9bec42021652
parentdadad2d984342643cad8b2d22b7549f986d3e05e (diff)
downloadpk-d88671efdfd08f5fcb33b4c4099d79eb82978c62.zip
pk-d88671efdfd08f5fcb33b4c4099d79eb82978c62.tar.gz
pk-d88671efdfd08f5fcb33b4c4099d79eb82978c62.tar.bz2
Remove uarch counters
We'll re-add support for the generic performance counter facility once it exists.
-rw-r--r--pk/handlers.c7
-rw-r--r--pk/pk.c42
-rw-r--r--pk/pk.h1
-rw-r--r--pk/syscall.c1
4 files changed, 0 insertions, 51 deletions
diff --git a/pk/handlers.c b/pk/handlers.c
index 71466b8..1961852 100644
--- a/pk/handlers.c
+++ b/pk/handlers.c
@@ -14,13 +14,6 @@ static void handle_illegal_instruction(trapframe_t* tf)
else
kassert(len == 2);
- // supply 0 for unimplemented uarch counters
- if ((tf->insn & (MASK_CSRRS | 0xcc0U<<20)) == (MATCH_CSRRS | 0xcc0U<<20)) {
- tf->gpr[(tf->insn >> 7) & 0x1f] = 0;
- tf->epc += 4;
- return;
- }
-
dump_tf(tf);
panic("An illegal instruction was executed!");
}
diff --git a/pk/pk.c b/pk/pk.c
index ab2e119..45fad14 100644
--- a/pk/pk.c
+++ b/pk/pk.c
@@ -8,42 +8,6 @@
elf_info current;
-#define NUM_COUNTERS 18
-static int uarch_counters_enabled;
-static long uarch_counters[NUM_COUNTERS];
-static char* uarch_counter_names[NUM_COUNTERS];
-
-static void read_uarch_counters(bool dump)
-{
- if (!uarch_counters_enabled)
- return;
-
- size_t i = 0;
- #define READ_CTR(name) do { \
- while (i >= NUM_COUNTERS) ; \
- long csr = read_csr(name); \
- if (dump && csr) printk("%s = %ld\n", #name, csr - uarch_counters[i]); \
- uarch_counters[i++] = csr; \
- } while (0)
- READ_CTR(0xcc0); READ_CTR(0xcc1); READ_CTR(0xcc2);
- READ_CTR(0xcc3); READ_CTR(0xcc4); READ_CTR(0xcc5);
- READ_CTR(0xcc6); READ_CTR(0xcc7); READ_CTR(0xcc8);
- READ_CTR(0xcc9); READ_CTR(0xcca); READ_CTR(0xccb);
- READ_CTR(0xccc); READ_CTR(0xccd); READ_CTR(0xcce);
- READ_CTR(0xccf); READ_CTR(cycle); READ_CTR(instret);
- #undef READ_CTR
-}
-
-static void start_uarch_counters()
-{
- read_uarch_counters(false);
-}
-
-void dump_uarch_counters()
-{
- read_uarch_counters(true);
-}
-
static void handle_option(const char* s)
{
switch (s[1])
@@ -52,10 +16,6 @@ static void handle_option(const char* s)
current.t0 = 1;
break;
- case 'c': // print uarch counters upon termination
- uarch_counters_enabled = 1;
- break;
-
default:
panic("unrecognized option: `%c'", s[1]);
break;
@@ -148,8 +108,6 @@ static void run_loaded_program(size_t argc, char** argv, uintptr_t kstack_top)
if (current.t0) // start timer if so requested
current.t0 = rdcycle();
- start_uarch_counters();
-
trapframe_t tf;
init_tf(&tf, current.entry, stack_top);
__clear_cache(0, 0);
diff --git a/pk/pk.h b/pk/pk.h
index 2c68c93..1167f6e 100644
--- a/pk/pk.h
+++ b/pk/pk.h
@@ -35,7 +35,6 @@ int vsnprintf(char* out, size_t n, const char* s, va_list vl);
int snprintf(char* out, size_t n, const char* s, ...);
void start_user(trapframe_t* tf) __attribute__((noreturn));
void dump_tf(trapframe_t*);
-void dump_uarch_counters();
static inline int insn_len(long insn)
{
diff --git a/pk/syscall.c b/pk/syscall.c
index 9f2be88..8d9a661 100644
--- a/pk/syscall.c
+++ b/pk/syscall.c
@@ -17,7 +17,6 @@ void sys_exit(int code)
{
if (current.t0)
printk("%ld cycles\n", rdcycle() - current.t0);
- dump_uarch_counters();
shutdown(code);
}