-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[do not merge] rhealstone benchmark #1240
base: master
Are you sure you want to change the base?
Conversation
JIRA: RTOS-883
JIRA: RTOS-883
Timer count can be read from a configuration register. JIRA: RTOS-883
#define FTMCTRL_BASE 0xff903000 | ||
|
||
|
||
#define RAM_ADDR 0x07000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clang-format-pr] reported by reviewdog 🐶
suggested fix
#define RAM_ADDR 0x07000000 | |
#define RAM_ADDR 0x07000000 |
|
||
ROOTFS="$PREFIX_BOOT/rootfs.jffs2" | ||
|
||
local erase_sz=$(image_builder.py query --nvm "$NVM_CONFIG" '{{ nvm.flash0._meta.block_size }}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mv "$ROOTFS.tmp" "$ROOTFS" | ||
fi | ||
|
||
local FS_OFFS=$(image_builder.py query --nvm "$NVM_CONFIG" '{{ nvm.flash0.rootfs.offs }}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fi | ||
|
||
local FS_OFFS=$(image_builder.py query --nvm "$NVM_CONFIG" '{{ nvm.flash0.rootfs.offs }}') | ||
local FS_SZ=$(image_builder.py query --nvm "$NVM_CONFIG" '{{ nvm.flash0.rootfs.size }}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -63,10 +61,11 @@ b_image_target() { | |||
|
|||
ROOTFS="$PREFIX_BOOT/rootfs.jffs2" | |||
|
|||
local erase_sz=$(image_builder.py query --nvm "$NVM_CONFIG" '{{ nvm.flash0._meta.block_size }}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ "${BASH_SOURCE[0]}" -ef "$0" ] && echo "You should source this script, not execute it!" && exit 1 | ||
|
||
|
||
FLASH_SZ=$((0x8000000)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
FLASH_SZ=$((0x8000000)) | ||
ROOTFS_SZ=$((0x800000)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c77cf08
to
2227a5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General remark - watch out for atomics, these might have some heavy overheads (including unexpected mutex in some cases). Perhaps it's ok, but we can't be sure without inspecting resulting binary
|
||
bool deadBrk; | ||
atomic_int count = 0; | ||
atomic_bool done = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be volatile
, but I'm not sure what exact effect it has on atomic_
s
benchStart = getCntr(); | ||
|
||
priority(4); | ||
|
||
usleep(0); | ||
|
||
threadJoin(tid1, 0); | ||
|
||
benchEnd = getCntr(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We introduce 2 syscalls overhead here that skews the result. Perhaps we could measure the time in task1
instead?
_user/rhealstone/irq-latency/main.c
Outdated
|
||
#define BENCHMARKS 10000 | ||
|
||
atomic_uint_least64_t benchEnd = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Atomic might give unwanted overhead, especially 64 bit one - we trigger the interrupt via SW, so should be fine to use plain volatile
_user/rhealstone/irq-latency/main.c
Outdated
|
||
int irqHandler(unsigned int n, void *arg) | ||
{ | ||
if (n == IRQ_UNUSED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if
is not strictly needed - we provide n
argument as a way for one handler to handle more than one interrupt, check on n
is not enforced
_user/rhealstone/irq-latency/main.c
Outdated
{ | ||
BENCH_NAME("Interrupt latency"); | ||
|
||
uint32_t *irqCtrl = mmap(NULL, _PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_DEVICE | MAP_PHYSMEM | MAP_ANONYMOUS, -1, (uintptr_t)INT_CTRL_BASE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be volatile, actually it's kinda weird that the access to the irqCtrl
hasn't been optimized out. Are we sure we have -O2
?
_user/rhealstone/msg-latency/main.c
Outdated
uint64_t loopOverhead = getCntr(); | ||
|
||
for (volatile int i = 0; i < BENCHMARKS; i++) { | ||
} | ||
|
||
for (volatile int i = 0; i < BENCHMARKS; i++) { | ||
} | ||
|
||
loopOverhead = getCntr() - loopOverhead; | ||
|
||
uint64_t joinOverhead = threadJoinOverhead(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for performance calibration, I assume. nop
version might be better, we use non-volatile iterator in the use-case
_user/rhealstone/msg-latency/main.c
Outdated
uint64_t benchStart = getCntr(); | ||
|
||
priority(4); | ||
usleep(0); | ||
|
||
threadJoin(tid1, 0); | ||
threadJoin(tid2, 0); | ||
|
||
uint64_t benchEnd = getCntr(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could store start time in task1 and end time in task2? This would eliminate 3 syscalls and context switch overheads from the test
_user/rhealstone/preempt/main.c
Outdated
for (volatile int cnt2 = 0; cnt2 < MAX_LOOPS; cnt2++) { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this one is for task2. Then nop version is more adequate
_user/rhealstone/preempt/main.c
Outdated
benchStart = getCntr(); | ||
priority(4); | ||
|
||
usleep(0); | ||
|
||
threadJoin(tid1, 0); | ||
threadJoin(tid2, 0); | ||
|
||
benchEnd = getCntr(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as other cases, perhaps time the execution in threads instead
_user/rhealstone/task-switch/main.c
Outdated
for (volatile unsigned int i = 0; i < MAX_LOOPS; i++) { | ||
/* usleep(0); */ | ||
} | ||
for (volatile unsigned int i = 0; i < MAX_LOOPS; i++) { | ||
/* usleep(0); */ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imho volatile -> nop
2227a5f
to
f61c6ee
Compare
Description
Motivation and Context
Types of changes
How Has This Been Tested?
Checklist:
Special treatment