diff options
Diffstat (limited to 'lib/ultralib/src/debug/threadprofilestop.c')
| -rw-r--r-- | lib/ultralib/src/debug/threadprofilestop.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/ultralib/src/debug/threadprofilestop.c b/lib/ultralib/src/debug/threadprofilestop.c new file mode 100644 index 0000000..666d7cd --- /dev/null +++ b/lib/ultralib/src/debug/threadprofilestop.c @@ -0,0 +1,34 @@ +#include "osint_debug.h" + +void osThreadProfileStop(void) { + register u32 saveMask; + int i; + OSId id; + u32 now_time = osGetCount(); + + saveMask = __osDisableInt(); + + if (__osThprofFlag == 0) { + __osRestoreInt(saveMask); + __osError(138, 0); + return; + } + + if (__osThprofFunc != NULL) { + id = osGetThreadId(0); + + if (id < THPROF_IDMAX) { + thprof[id].time += now_time - __osThprofLastTimer; + } else { + __osRestoreInt(saveMask); + __osError(147, 1, id); + saveMask = __osDisableInt(); + } + } + __osThprofFunc = NULL; + + for (i = 0; i < THPROF_IDMAX; i++) { + thprof[i].flag = 0; + } + __osRestoreInt(saveMask); +} |
