diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-01-03 18:48:58 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-01-03 18:48:58 +0000 |
commit | 1b884f11935d8942a8e79cfe02145094d6c52e64 (patch) | |
tree | 9cbec5fc17c7a9807897e7c939e824cb5b69d9b2 | |
parent | c694719a16c738d901b5efc0e28d9503a52ba7b7 (diff) |
Print stack usage upon thread exiting
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1659 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjlib/src/pj/os_core_win32.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pjlib/src/pj/os_core_win32.c b/pjlib/src/pj/os_core_win32.c index fcacaf4b..4bc8a970 100644 --- a/pjlib/src/pj/os_core_win32.c +++ b/pjlib/src/pj/os_core_win32.c @@ -198,6 +198,15 @@ PJ_DEF(void) pj_shutdown() { int i; + /* Display stack usage */ +#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0 + { + pj_thread_t *rec = (pj_thread_t*)main_thread; + PJ_LOG(5,(rec->obj_name, "Main thread stack max usage=%u by %s:%d", + rec->stk_max_usage, rec->caller_file, rec->caller_line)); + } +#endif + /* Call atexit() functions */ for (i=atexit_count-1; i>=0; --i) { (*atexit_func[i])(); @@ -349,6 +358,11 @@ static DWORD WINAPI thread_main(void *param) result = (*rec->proc)(rec->arg); PJ_LOG(6,(rec->obj_name, "Thread quitting")); +#if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0 + PJ_LOG(5,(rec->obj_name, "Thread stack max usage=%u by %s:%d", + rec->stk_max_usage, rec->caller_file, rec->caller_line)); +#endif + return (DWORD)result; } |