Commit 7583a4e2 authored by Alexei Starovoitov's avatar Alexei Starovoitov

use __builtin_memcpy() instead of unrolled loop

also remove tab and unused import
Signed-off-by: default avatarAlexei Starovoitov <ast@fb.com>
parent 143df809
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
from __future__ import print_function from __future__ import print_function
from bcc import BPF from bcc import BPF
from time import sleep, strftime from time import sleep
import argparse import argparse
import signal import signal
...@@ -184,37 +184,8 @@ int oncpu(struct pt_regs *ctx, struct task_struct *p) { ...@@ -184,37 +184,8 @@ int oncpu(struct pt_regs *ctx, struct task_struct *p) {
out: out:
woke = wokeby.lookup(&pid); woke = wokeby.lookup(&pid);
if (woke) { if (woke) {
// unrolled loop (MAXWDEPTH): __builtin_memcpy(&key.wret, woke->ret, sizeof(key.wret));
depth = 0; __builtin_memcpy(&key.waker, woke->name, TASK_COMM_LEN);
key.wret[depth] = woke->ret[depth]; depth++;
key.wret[depth] = woke->ret[depth]; depth++;
key.wret[depth] = woke->ret[depth]; depth++;
key.wret[depth] = woke->ret[depth]; depth++;
key.wret[depth] = woke->ret[depth]; depth++;
key.wret[depth] = woke->ret[depth]; depth++;
key.wret[depth] = woke->ret[depth]; depth++;
key.wret[depth] = woke->ret[depth]; depth++;
key.wret[depth] = woke->ret[depth]; depth++;
key.wret[depth] = woke->ret[depth];
// unrolled loop (TASK_COMM_LEN):
depth = 0;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth]; depth++;
key.waker[depth] = woke->name[depth];
wokeby.delete(&pid); wokeby.delete(&pid);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment