blob: 9930cacd401882ba6e9d345674b83f4a0d4459ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include "osint_debug.h"
OSTime osThreadProfileReadTime(OSId id) {
OSTime adjust = 0;
u32 now_time = osGetCount();
#ifndef NDEBUG
if (!__osThprofFlag) {
__osError(140, 0);
return 0;
}
#endif
if (id >= THPROF_IDMAX) {
#ifndef NDEBUG
__osError(144, 1, id);
#endif
return 0;
}
if (id == osGetThreadId(NULL) && __osThprofFunc != NULL) {
adjust = now_time - __osThprofLastTimer;
}
return thprof[id].time + adjust;
}
OSTime osThreadProfileReadTimeTh(OSThread* thread) {
OSId id;
OSTime adjust = 0;
u32 now_time = osGetCount();
#ifndef NDEBUG
if (!__osThprofFlag) {
__osError(142, 0);
return 0;
}
#endif
id = osGetThreadId(thread);
if (id >= THPROF_IDMAX) {
#ifndef NDEBUG
__osError(146, 1, id);
#endif
return 0;
}
if (id == osGetThreadId(NULL) && __osThprofFunc != NULL) {
adjust = now_time - __osThprofLastTimer;
}
return thprof[id].time + adjust;
}
|