summaryrefslogtreecommitdiff
path: root/lib/ultralib/src/debug/threadprofilereadcount.c
blob: 32379879090353515e6b8fbb0ba7d49093d2427e (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
#include "osint_debug.h"

u32 osThreadProfileReadCount(OSId id) {
#ifndef NDEBUG
    if (!__osThprofFlag) {
        __osError(139, 0);
        return 0;
    }
#endif

    if (id >= THPROF_IDMAX) {
#ifndef NDEBUG
        __osError(143, 1, id);
#endif
        return 0;
    }
    return thprof[id].count;
}

u32 osThreadProfileReadCountTh(OSThread* thread) {
    OSId id;

#ifndef NDEBUG
    if (!__osThprofFlag) {
        __osError(141, 0);
        return 0;
    }
#endif

    id = osGetThreadId(thread);

    if (id >= THPROF_IDMAX) {
#ifndef NDEBUG
        __osError(145, 1, id);
#endif
        return 0;
    }
    return thprof[id].count;
}