rt debug scripts (#2165)
* rt debug scripts
* bigger buffer
* cleanup
* move to internal
Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: ebab660622
commatwo_master
parent
c6cfa6e30f
commit
2f8213f997
4 changed files with 94 additions and 0 deletions
@ -0,0 +1,2 @@ |
||||
#!/usr/bin/bash |
||||
echo "restart" > /sys/kernel/debug/msm_subsys/modem |
@ -0,0 +1,4 @@ |
||||
#!/usr/bin/bash |
||||
|
||||
echo 96000 > /d/tracing/buffer_size_kb |
||||
atrace -t 10 sched workq -b 96000 > /tmp/trace.txt |
@ -0,0 +1,25 @@ |
||||
#!/usr/bin/bash |
||||
|
||||
cd /d/tracing |
||||
|
||||
# setup tracer |
||||
echo "function" > current_tracer |
||||
|
||||
echo "start tracing" |
||||
echo 1 > tracing_on |
||||
|
||||
# do stuff |
||||
sleep 2 |
||||
#/data/openpilot/scripts/restart_modem.sh |
||||
#sleep 3 |
||||
#/data/openpilot/scripts/restart_modem.sh |
||||
sleep 5 |
||||
|
||||
# disable tracing |
||||
echo "done tracing" |
||||
echo 0 > tracing_on |
||||
|
||||
# copy |
||||
echo "copy traces" |
||||
cp trace /tmp/trace.txt |
||||
cp per_cpu/cpu3/trace /tmp/trace_cpu3.txt |
@ -0,0 +1,63 @@ |
||||
#define _GNU_SOURCE |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <sched.h> |
||||
#include <arm_neon.h> |
||||
#include <sys/prctl.h> |
||||
#include <sys/syscall.h> |
||||
#include "../../common/util.h" |
||||
#include "../../common/timing.h" |
||||
|
||||
#define CORES 3 |
||||
double ttime[CORES]; |
||||
double oout[CORES]; |
||||
|
||||
void waste(int core) { |
||||
prctl(PR_SET_NAME, (unsigned long)"waste", 0, 0, 0); |
||||
|
||||
cpu_set_t my_set; |
||||
CPU_ZERO(&my_set); |
||||
CPU_SET(core, &my_set); |
||||
int ret = sched_setaffinity(0, sizeof(cpu_set_t), &my_set); |
||||
printf("set affinity to %d: %d\n", core, ret); |
||||
|
||||
//struct sched_param sa;
|
||||
//memset(&sa, 0, sizeof(sa));
|
||||
//sa.sched_priority = 51;
|
||||
//sched_setscheduler(syscall(SYS_gettid), SCHED_FIFO, &sa);
|
||||
|
||||
float32x4_t *tmp = (float32x4_t *)malloc(0x1000008*sizeof(float32x4_t)); |
||||
float32x4_t out; |
||||
|
||||
uint64_t i = 0; |
||||
double sec = seconds_since_boot(); |
||||
while(1) { |
||||
int j; |
||||
for (j = 0; j < 0x1000000; j++) { |
||||
out = vmlaq_f32(out, tmp[j], tmp[j+1]); |
||||
} |
||||
if (i == 0x8) { |
||||
double nsec = seconds_since_boot(); |
||||
ttime[core] = nsec-sec; |
||||
oout[core] = out[0] + out[1] + out[2] + out[3]; |
||||
i = 0; |
||||
sec = nsec; |
||||
} |
||||
i++; |
||||
} |
||||
} |
||||
|
||||
int main() { |
||||
pthread_t waster[CORES]; |
||||
for (int i = 0 ; i < CORES; i++) { |
||||
pthread_create(&waster[i], NULL, waste, (void*)i); |
||||
} |
||||
while (1) { |
||||
for (int i = 0 ; i < CORES; i++) { |
||||
printf("%.2f ", ttime[i]); |
||||
} |
||||
printf("\n"); |
||||
sleep(1); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue