Print statistics at power off.
[pintos-anon] / src / threads / init.c
index 1afa8653dc6c828f8ab79ad3c500ce69eaee5cc0..9774493d9e31f8af5687d421d3f0d987e17f389f 100644 (file)
@@ -55,6 +55,7 @@ static bool do_power_off;
 static void ram_init (void);
 static void paging_init (void);
 static void argv_init (void);
+static void print_stats (void);
 
 int main (void) NO_RETURN;
 
@@ -282,6 +283,8 @@ power_off (void)
   filesys_done ();
 #endif
 
+  print_stats ();
+
   printf ("Powering off...\n");
   serial_flush ();
 
@@ -289,3 +292,19 @@ power_off (void)
     outb (0x8900, *p);
   for (;;);
 }
+
+/* Print statistics about Pintos execution. */
+static void
+print_stats (void) 
+{
+  timer_print_stats ();
+  thread_print_stats ();
+#ifdef FILESYS
+  disk_print_stats ();
+#endif
+  console_print_stats ();
+  kbd_print_stats ();
+#ifdef USERPROG
+  exception_print_stats ();
+#endif
+}