Log update's CPU use (user and system time)
This commit is contained in:
parent
154bb241f0
commit
3dafd404fa
1 changed files with 9 additions and 1 deletions
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <sys/resource.h>
|
||||||
#include "budg.h"
|
#include "budg.h"
|
||||||
#include "empthread.h"
|
#include "empthread.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
@ -56,6 +57,7 @@ void
|
||||||
update_main(void)
|
update_main(void)
|
||||||
{
|
{
|
||||||
int etu = etu_per_update;
|
int etu = etu_per_update;
|
||||||
|
struct rusage rus1, rus2;
|
||||||
int n;
|
int n;
|
||||||
int i;
|
int i;
|
||||||
struct bp *bp;
|
struct bp *bp;
|
||||||
|
@ -63,6 +65,7 @@ update_main(void)
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
|
||||||
logerror("production update (%d etus)", etu);
|
logerror("production update (%d etus)", etu);
|
||||||
|
getrusage(RUSAGE_SELF, &rus1);
|
||||||
game_record_update(time(NULL));
|
game_record_update(time(NULL));
|
||||||
journal_update(etu);
|
journal_update(etu);
|
||||||
|
|
||||||
|
@ -154,5 +157,10 @@ update_main(void)
|
||||||
/* Clear all the telegram flags */
|
/* Clear all the telegram flags */
|
||||||
for (cn = 0; cn < MAXNOC; cn++)
|
for (cn = 0; cn < MAXNOC; cn++)
|
||||||
clear_telegram_is_new(cn);
|
clear_telegram_is_new(cn);
|
||||||
logerror("End update");
|
getrusage(RUSAGE_SELF, &rus2);
|
||||||
|
logerror("End update %g user %g system",
|
||||||
|
rus2.ru_utime.tv_sec + rus2.ru_utime.tv_usec / 1e6
|
||||||
|
- (rus1.ru_utime.tv_sec + rus1.ru_utime.tv_usec / 1e6),
|
||||||
|
rus2.ru_stime.tv_sec + rus2.ru_stime.tv_usec / 1e6
|
||||||
|
- (rus1.ru_stime.tv_sec + rus1.ru_stime.tv_usec / 1e6));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue