]> git.itanic.dy.fi Git - sdl-planets/commitdiff
Print different stats
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Mon, 12 Apr 2010 17:32:39 +0000 (20:32 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Mon, 12 Apr 2010 17:33:26 +0000 (20:33 +0300)
main.c
planet.c
planet.h

diff --git a/main.c b/main.c
index 04321d365170be81bf507476b6335bca6b8af1ea..4dab322e19684bd6f9939b6fb44044b222b9d9ce 100644 (file)
--- a/main.c
+++ b/main.c
@@ -218,6 +218,7 @@ static void loop(SDL_Surface *screen, int num_of_planets, double total_mass,
        while (1) {
                planets = 0;
                gravitations = 0;
+               optimizations = 0;
 
                gravitize_planet_tree(planet_root, step_time);
 
@@ -292,12 +293,13 @@ static void loop(SDL_Surface *screen, int num_of_planets, double total_mass,
 
                printf("  \rfps: %.2f, steps/s: %.2f, planets: %d"
                       ", scale %.2f, zoom %.2f, step %ld, visible %d,"
-                      " depth %ld, c:%ld, mass %.f, area: %.f, g: %.2f",
+                      " depth %ld, c:%ld, area: %.f, g: %.f %.f",
                       last_fps, last_sps, planets, status.time_scale,
                       camera.zoom, step_count, visible_planets,
                       planet_root->tree.depth, planet_root->tree.children,
-                      planet_root->tree_mass, planet_root->tree_area,
-                      gravitations / (float) planets);
+                      planet_root->tree_area,
+                      gravitations / (float) planets,
+                      optimizations / (float) planets);
                fflush(stdout);
 
 
index 96833221b1d1893692b210b6e31dff34f492dc6e..33f7cdecf439c3836afcd51ec300b63302b200c4 100644 (file)
--- a/planet.c
+++ b/planet.c
@@ -5,7 +5,7 @@
 #include "utils.h"
 
 struct quadtree_ops planet_ops;
-int gravitations;
+int gravitations, optimizations;
 
 static void putpixel(struct SDL_Surface *screen, const int x, const int y,
                     const unsigned char r, const unsigned char g,
@@ -252,6 +252,7 @@ static void gravitize_planet(struct planet *p, struct planet *pt, double time)
                 * OK, the node is far enough. We can approximate the
                 * entire tree as a single entity.
                 */
+               optimizations += pt->tree.children;
                gravitize_planet_with_tree(p, pt, time);
                return;
        }
index 446ad406c76ce26e3f514fdeded172b05db75e68..bc18fcfbd0072cfee9288e417ac1f2878c86a3b3 100644 (file)
--- a/planet.h
+++ b/planet.h
@@ -31,7 +31,7 @@ struct planet_search_iterator {
        SDL_Surface *screen;
 };
 
-extern int gravitations;
+extern int gravitations, optimizations;
 
 #define list_to_planet(list_head) container_of((list_head), struct planet, list)