android_mt6572_jiabo/system/extras/simpleperf/runtest/function_fork.cpp
2025-09-05 16:56:03 +08:00

24 lines
360 B
C++

#include <unistd.h>
constexpr int LOOP_COUNT = 100000000;
void ParentFunction() {
for (volatile int i = 0; i < LOOP_COUNT; ++i) {
}
}
void ChildFunction() {
for (volatile int i = 0; i < LOOP_COUNT; ++i) {
}
}
int main() {
pid_t pid = fork();
if (pid == 0) {
ChildFunction();
return 0;
} else {
ParentFunction();
}
return 0;
}