Fossil SCM
Show the resident set size (RSS) on the /test_env page.
Commit
b00e20c7ecabf3c4c36fd99018af52f5f2be9a717d463bb0e834e2e52b759711
Parent
85b139c3abc2ca0…
2 files changed
+3
+14
+3
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -1243,10 +1243,13 @@ | ||
| 1243 | 1243 | if( zCap[0] ){ |
| 1244 | 1244 | @ anonymous-adds = %s(find_anon_capabilities(zCap))<br /> |
| 1245 | 1245 | } |
| 1246 | 1246 | @ g.zRepositoryName = %h(g.zRepositoryName)<br /> |
| 1247 | 1247 | @ load_average() = %f(load_average())<br /> |
| 1248 | +#ifndef _WIN32 | |
| 1249 | + @ RSS = %.2f(fossil_rss()/1000000.0) MB</br /> | |
| 1250 | +#endif | |
| 1248 | 1251 | @ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br /> |
| 1249 | 1252 | @ fossil_exe_id() = %h(fossil_exe_id())<br /> |
| 1250 | 1253 | @ <hr /> |
| 1251 | 1254 | P("HTTP_USER_AGENT"); |
| 1252 | 1255 | cgi_print_all(showAll, 0); |
| 1253 | 1256 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1243,10 +1243,13 @@ | |
| 1243 | if( zCap[0] ){ |
| 1244 | @ anonymous-adds = %s(find_anon_capabilities(zCap))<br /> |
| 1245 | } |
| 1246 | @ g.zRepositoryName = %h(g.zRepositoryName)<br /> |
| 1247 | @ load_average() = %f(load_average())<br /> |
| 1248 | @ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br /> |
| 1249 | @ fossil_exe_id() = %h(fossil_exe_id())<br /> |
| 1250 | @ <hr /> |
| 1251 | P("HTTP_USER_AGENT"); |
| 1252 | cgi_print_all(showAll, 0); |
| 1253 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1243,10 +1243,13 @@ | |
| 1243 | if( zCap[0] ){ |
| 1244 | @ anonymous-adds = %s(find_anon_capabilities(zCap))<br /> |
| 1245 | } |
| 1246 | @ g.zRepositoryName = %h(g.zRepositoryName)<br /> |
| 1247 | @ load_average() = %f(load_average())<br /> |
| 1248 | #ifndef _WIN32 |
| 1249 | @ RSS = %.2f(fossil_rss()/1000000.0) MB</br /> |
| 1250 | #endif |
| 1251 | @ cgi_csrf_safe(0) = %d(cgi_csrf_safe(0))<br /> |
| 1252 | @ fossil_exe_id() = %h(fossil_exe_id())<br /> |
| 1253 | @ <hr /> |
| 1254 | P("HTTP_USER_AGENT"); |
| 1255 | cgi_print_all(showAll, 0); |
| 1256 |
+14
| --- src/util.c | ||
| +++ src/util.c | ||
| @@ -425,10 +425,24 @@ | ||
| 425 | 425 | *piKernel = |
| 426 | 426 | ((sqlite3_uint64)s.ru_stime.tv_sec)*1000000 + s.ru_stime.tv_usec; |
| 427 | 427 | } |
| 428 | 428 | #endif |
| 429 | 429 | } |
| 430 | + | |
| 431 | +/* | |
| 432 | +** Return the resident set size for this process | |
| 433 | +*/ | |
| 434 | +sqlite3_uint64 fossil_rss(void){ | |
| 435 | +#ifdef _WIN32 | |
| 436 | + return 0; | |
| 437 | +#else | |
| 438 | + struct rusage s; | |
| 439 | + getrusage(RUSAGE_SELF, &s); | |
| 440 | + return s.ru_maxrss*1024; | |
| 441 | +#endif | |
| 442 | +} | |
| 443 | + | |
| 430 | 444 | |
| 431 | 445 | /* |
| 432 | 446 | ** Internal helper type for fossil_timer_xxx(). |
| 433 | 447 | */ |
| 434 | 448 | enum FossilTimerEnum { |
| 435 | 449 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -425,10 +425,24 @@ | |
| 425 | *piKernel = |
| 426 | ((sqlite3_uint64)s.ru_stime.tv_sec)*1000000 + s.ru_stime.tv_usec; |
| 427 | } |
| 428 | #endif |
| 429 | } |
| 430 | |
| 431 | /* |
| 432 | ** Internal helper type for fossil_timer_xxx(). |
| 433 | */ |
| 434 | enum FossilTimerEnum { |
| 435 |
| --- src/util.c | |
| +++ src/util.c | |
| @@ -425,10 +425,24 @@ | |
| 425 | *piKernel = |
| 426 | ((sqlite3_uint64)s.ru_stime.tv_sec)*1000000 + s.ru_stime.tv_usec; |
| 427 | } |
| 428 | #endif |
| 429 | } |
| 430 | |
| 431 | /* |
| 432 | ** Return the resident set size for this process |
| 433 | */ |
| 434 | sqlite3_uint64 fossil_rss(void){ |
| 435 | #ifdef _WIN32 |
| 436 | return 0; |
| 437 | #else |
| 438 | struct rusage s; |
| 439 | getrusage(RUSAGE_SELF, &s); |
| 440 | return s.ru_maxrss*1024; |
| 441 | #endif |
| 442 | } |
| 443 | |
| 444 | |
| 445 | /* |
| 446 | ** Internal helper type for fossil_timer_xxx(). |
| 447 | */ |
| 448 | enum FossilTimerEnum { |
| 449 |