From c062021a34efd1816f8595dc7426c54b9dd3258b Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 14 Aug 2015 20:44:13 -0700 Subject: 1999 Still worth trying to optimize, though. Current lowest-hanging fruit: stop having index/index-address copy entire arrays around. --- 020run.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/020run.cc b/020run.cc index 3478f5d2..504dca88 100644 --- a/020run.cc +++ b/020run.cc @@ -45,6 +45,8 @@ struct routine { :(before "End Globals") routine* Current_routine = NULL; map Instructions_running; +map Locations_read; +map Locations_read_by_instruction; :(code) void run(recipe_ordinal r) { @@ -71,6 +73,8 @@ void run_current_routine() vector > ingredients; for (long long int i = 0; i < SIZE(current_instruction().ingredients); ++i) { ingredients.push_back(read_memory(current_instruction().ingredients.at(i))); + Locations_read[current_recipe_name()] += SIZE(ingredients.back()); + Locations_read_by_instruction[current_instruction().name] += SIZE(ingredients.back()); } // Instructions below will write to 'products'. vector > products; @@ -161,6 +165,14 @@ void dump_profile() { for (map::iterator p = Instructions_running.begin(); p != Instructions_running.end(); ++p) { cerr << p->first << ": " << p->second << '\n'; } + cerr << "== locations read\n"; + for (map::iterator p = Locations_read.begin(); p != Locations_read.end(); ++p) { + cerr << p->first << ": " << p->second << '\n'; + } + cerr << "== locations read by instruction\n"; + for (map::iterator p = Locations_read_by_instruction.begin(); p != Locations_read_by_instruction.end(); ++p) { + cerr << p->first << ": " << p->second << '\n'; + } } :(code) -- cgit 1.4.1-2-gfad0