about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-14 20:44:13 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-14 20:44:13 -0700
commitc062021a34efd1816f8595dc7426c54b9dd3258b (patch)
treec55a282f8f9a9416722a270d607c3059ab55b57b
parent41b9fb5a1da19d5ccf67d82d77d3844781fa2558 (diff)
downloadmu-c062021a34efd1816f8595dc7426c54b9dd3258b.tar.gz
1999
Still worth trying to optimize, though. Current lowest-hanging fruit:
stop having index/index-address copy entire arrays around.
-rw-r--r--020run.cc12
1 files changed, 12 insertions, 0 deletions
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<string, long long int> Instructions_running;
+map<string, long long int> Locations_read;
+map<string, long long int> Locations_read_by_instruction;
 
 :(code)
 void run(recipe_ordinal r) {
@@ -71,6 +73,8 @@ void run_current_routine()
     vector<vector<double> > 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<vector<double> > products;
@@ -161,6 +165,14 @@ void dump_profile() {
   for (map<string, long long int>::iterator p = Instructions_running.begin(); p != Instructions_running.end(); ++p) {
     cerr << p->first << ": " << p->second << '\n';
   }
+  cerr << "== locations read\n";
+  for (map<string, long long int>::iterator p = Locations_read.begin(); p != Locations_read.end(); ++p) {
+    cerr << p->first << ": " << p->second << '\n';
+  }
+  cerr << "== locations read by instruction\n";
+  for (map<string, long long int>::iterator p = Locations_read_by_instruction.begin(); p != Locations_read_by_instruction.end(); ++p) {
+    cerr << p->first << ": " << p->second << '\n';
+  }
 }
 
 :(code)