Add performance timing debug option

This commit is contained in:
Jeremy Lakeman 2012-07-25 12:14:53 +09:30
parent 9a16fe4e96
commit 5ec739c712
4 changed files with 12 additions and 7 deletions

View File

@ -289,8 +289,8 @@ int parseCommandLine(const char *argv0, int argc, const char *const *args)
/* clean up after ourselves */ /* clean up after ourselves */
overlay_mdp_client_done(); overlay_mdp_client_done();
OUT(); OUT();
//TODO debug flag for method profiling
if (1) if (debug&DEBUG_TIMING)
fd_showstats(); fd_showstats();
return result; return result;
} }

2
log.c
View File

@ -246,6 +246,8 @@ unsigned int debugFlagMask(const char *flagname) {
else if (!strcasecmp(flagname,"broadcasts")) return DEBUG_BROADCASTS; else if (!strcasecmp(flagname,"broadcasts")) return DEBUG_BROADCASTS;
else if (!strcasecmp(flagname,"manifests")) return DEBUG_MANIFESTS; else if (!strcasecmp(flagname,"manifests")) return DEBUG_MANIFESTS;
else if (!strcasecmp(flagname,"mdprequests")) return DEBUG_MDPREQUESTS; else if (!strcasecmp(flagname,"mdprequests")) return DEBUG_MDPREQUESTS;
else if (!strcasecmp(flagname,"timing")) return DEBUG_TIMING;
return 0; return 0;
} }

View File

@ -128,9 +128,9 @@ int overlayServerMode()
/* Create structures to use 1MB of RAM for testing */ /* Create structures to use 1MB of RAM for testing */
overlay_route_init(1); overlay_route_init(1);
#define SCHEDULE(X, Y, D) \ #define SCHEDULE(X, Y, D) { \
struct sched_ent _sched_##X; \ static struct sched_ent _sched_##X; \
struct profile_total _stats_##X; \ static struct profile_total _stats_##X; \
bzero(&_sched_##X, sizeof(struct sched_ent)); \ bzero(&_sched_##X, sizeof(struct sched_ent)); \
bzero(&_stats_##X, sizeof(struct profile_total)); \ bzero(&_stats_##X, sizeof(struct profile_total)); \
_sched_##X.stats = &_stats_##X; \ _sched_##X.stats = &_stats_##X; \
@ -138,7 +138,7 @@ _sched_##X.function=X;\
_stats_##X.name="" #X "";\ _stats_##X.name="" #X "";\
_sched_##X.alarm=overlay_gettime_ms()+Y;\ _sched_##X.alarm=overlay_gettime_ms()+Y;\
_sched_##X.deadline=_sched_##X.alarm+D;\ _sched_##X.deadline=_sched_##X.alarm+D;\
schedule(&_sched_##X); schedule(&_sched_##X); }
/* Periodically check for server shut down */ /* Periodically check for server shut down */
SCHEDULE(server_shutdown_check, 0, 100); SCHEDULE(server_shutdown_check, 0, 100);
@ -163,7 +163,9 @@ schedule(&_sched_##X);
SCHEDULE(overlay_route_tick, 100, 100); SCHEDULE(overlay_route_tick, 100, 100);
/* Show CPU usage stats periodically */ /* Show CPU usage stats periodically */
SCHEDULE(fd_periodicstats, 3000, 500); if (debug&DEBUG_TIMING){
SCHEDULE(fd_periodicstats, 3000, 500);
}
#undef SCHEDULE #undef SCHEDULE

View File

@ -1123,6 +1123,7 @@ int overlay_saw_mdp_containing_frame(overlay_frame *f,long long now);
#define DEBUG_PACKETCONSTRUCTION (1 << 23) #define DEBUG_PACKETCONSTRUCTION (1 << 23)
#define DEBUG_MANIFESTS (1 << 24) #define DEBUG_MANIFESTS (1 << 24)
#define DEBUG_MDPREQUESTS (1 << 25) #define DEBUG_MDPREQUESTS (1 << 25)
#define DEBUG_TIMING (1 << 26)
/* bitmask values for monitor_tell_clients */ /* bitmask values for monitor_tell_clients */
#define MONITOR_VOMP (1<<0) #define MONITOR_VOMP (1<<0)