String TimingInspector::Dump() { Mutex::Lock __(mutex); String s = Sprintf("TIMING %-15s: ", name); if(call_count == 0) return s + "No active hit"; double tm = max(0.0, double(total_time) / call_count / 1000 - double(s_zero().total_time) / s_zero().call_count / 1000); return s + timeFormat(tm * call_count) + " - " + timeFormat(tm) + " (" + timeFormat((double)total_time / 1000) + " / " + Sprintf("%d )", call_count) + ", min: " + timeFormat((double)min_time / 1000) + ", max: " + timeFormat((double)max_time / 1000) + Sprintf(", nesting: %d - %d", max_nesting, all_count); }
const char * msg_proj_finder(const char * file) { static char * r = NULL; static int r_len = 0; s_zero(&r); s_cat(&r, &r_len, pth_cfg_files); s_cat(&r, &r_len, "/proj/"); s_cat(&r, &r_len, file); return r; }
TimingInspector::TimingInspector(const char *_name) { s_zero(); //!! atexit name = _name ? _name : ""; start_time = 0; all_count = call_count = max_nesting = nesting_depth = min_time = max_time = total_time = 0; static bool init; if(!init) { #if defined(PLATFORM_WIN32) && !defined(PLATFORM_WINCE) timeBeginPeriod(1); #endif init = true; } }
/* read word */ static void get_word(void) { s_zero(&buffer); skipblanks(); while (!isBlank(ch) && !isEol(ch)) { s_catchar(&buffer, &buf_len, (char)ch); nextch(); } if (!buffer) s_catchar(&buffer, &buf_len, '\0'); #if 0 printf("get_word() got “%s”\n", buffer); #endif }
extern void read_string(char **pstr, int *plen) { s_zero(pstr); skipblanks(); if (ch == '\"') { /* String quoted in "" */ nextch(); while (1) { if (isEol(ch)) { compile_error(-/*Missing \"*/69); LONGJMP(file.jbSkipLine); } if (ch == '\"') break; s_catchar(pstr, plen, ch); nextch(); } } else { /* Unquoted string */ while (1) { if (isEol(ch) || isComm(ch)) { if (!*pstr || !(*pstr)[0]) { compile_error(-/*Expecting string field*/121); LONGJMP(file.jbSkipLine); } return; } if (isBlank(ch)) break; s_catchar(pstr, plen, ch); nextch(); } } nextch(); }
/* read token */ extern void get_token(void) { int i = -1; s_zero(&buffer); osfree(ucbuffer); skipblanks(); while (isalpha(ch)) { s_catchar(&buffer, &buf_len, (char)ch); nextch(); } if (!buffer) s_catchar(&buffer, &buf_len, '\0'); ucbuffer = osmalloc(buf_len); do { i++; ucbuffer[i] = toupper(buffer[i]); } while (buffer[i]); #if 0 printf("get_token() got “%s”\n", buffer); #endif }
TimingInspector::~TimingInspector() { Mutex::Lock __(mutex); if(this == &s_zero()) return; StdLog() << Dump() << "\r\n"; }