mibuild/sim: avoid updating end at each cycle (simulation speedup)
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 3 Mar 2015 17:01:14 +0000 (18:01 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 3 Mar 2015 17:01:14 +0000 (18:01 +0100)
mibuild/sim/console_tb.cpp
mibuild/sim/server_tb.cpp

index f8668e8d09917ae8d00360f179b1987c3511cc84..9468d24d4761eb024c3311630fb9a1b3c2c0c3cf 100644 (file)
@@ -115,7 +115,6 @@ void sim_tick(struct sim *s)
        if (trace)
                tfp->dump(s->tick);
        s->tick++;
-       s->end = clock();
 }
 
 void sim_init(struct sim *s)
@@ -157,6 +156,7 @@ int main(int argc, char **argv, char **env)
                                s.run = false;
                }
        }
+       s.end = clock();
 
        speed = (s.tick/2)/((s.end-s.start)/CLOCKS_PER_SEC);
 
index 977206f9880811b3eccc28887da7e0dd6921a331..f92cc1678133f314195e48fff8010494be7727c9 100644 (file)
@@ -150,7 +150,6 @@ void sim_tick(struct sim *s)
        if (trace)
                tfp->dump(s->tick);
        s->tick++;
-       s->end = clock();
 }
 
 void sim_init(struct sim *s)
@@ -193,6 +192,7 @@ int main(int argc, char **argv, char **env)
                                s.run = false;
                }
        }
+       s.end = clock();
 
        tfp->close();
        pthread_cancel(sim_receive_thread);