@@ -19,61 +19,61 @@ __s64 n = 10;
1919SEC ("tracepoint/syscalls/sys_enter_execve" )
2020__s64 range_sum (void * ctx )
2121{
22- __s64 total = 0 ;
23- for (__s64 idx = 0 ; idx < 10 ; idx += 1 ) {
24- __s64 i = idx ;
25- total = total + 1 ;
26- }
27- return total ;
22+ __s64 total = 0 ;
23+ for (__s64 idx = 0 ; idx < 10 ; idx += 1 ) {
24+ __s64 i = idx ;
25+ total = total + 1 ;
26+ }
27+ return total ;
2828}
2929
3030/* for i in range(0, 10, 2): total = total + i */
3131SEC ("tracepoint/syscalls/sys_enter_execve" )
3232__s64 range_step (void * ctx )
3333{
34- __s64 total = 0 ;
35- for (__s64 idx = 0 ; idx < 10 ; idx += 2 ) {
36- __s64 i = idx ;
37- total = total + i ;
38- }
39- return total ;
34+ __s64 total = 0 ;
35+ for (__s64 idx = 0 ; idx < 10 ; idx += 2 ) {
36+ __s64 i = idx ;
37+ total = total + i ;
38+ }
39+ return total ;
4040}
4141
4242/* while i < 10: i = i + 1 */
4343SEC ("tracepoint/syscalls/sys_enter_execve" )
4444__s64 while_basic (void * ctx )
4545{
46- __s64 i = 0 ;
47- while (i < 10 )
48- i = i + 1 ;
49- return i ;
46+ __s64 i = 0 ;
47+ while (i < 10 )
48+ i = i + 1 ;
49+ return i ;
5050}
5151
5252/* while True: total += 1; if total == 10: break */
5353SEC ("tracepoint/syscalls/sys_enter_execve" )
5454__s64 while_true_break (void * ctx )
5555{
56- __s64 total = 0 ;
57- while (1 ) {
58- total = total + 1 ;
59- if (total == 10 )
60- break ;
61- }
62- return total ;
56+ __s64 total = 0 ;
57+ while (1 ) {
58+ total = total + 1 ;
59+ if (total == 10 )
60+ break ;
61+ }
62+ return total ;
6363}
6464
6565/* for i in range(10): if i % 2 == 0: continue; total = total + i */
6666SEC ("tracepoint/syscalls/sys_enter_execve" )
6767__s64 for_continue (void * ctx )
6868{
69- __s64 total = 0 ;
70- for (__s64 idx = 0 ; idx < 10 ; idx += 1 ) {
71- __s64 i = idx ;
72- if (i % 2 == 0 )
73- continue ;
74- total = total + i ;
75- }
76- return total ;
69+ __s64 total = 0 ;
70+ for (__s64 idx = 0 ; idx < 10 ; idx += 1 ) {
71+ __s64 i = idx ;
72+ if (i % 2 == 0 )
73+ continue ;
74+ total = total + i ;
75+ }
76+ return total ;
7777}
7878
7979static __u32 (* bpf_get_prandom_u32 )(void ) = (void * )7 ;
@@ -85,13 +85,13 @@ static __u32 (*bpf_get_prandom_u32)(void) = (void *)7;
8585SEC ("tracepoint/syscalls/sys_enter_execve" )
8686__s64 dyn_helper (void * ctx )
8787{
88- __s64 total = 0 ;
89- __s64 stop = n ;
90- if (stop > 64 )
91- stop = 64 ;
92- for (__s64 idx = 0 ; idx < stop ; idx += 1 ) {
93- __s64 i = idx ;
94- total = total + bpf_get_prandom_u32 ();
95- }
96- return total ;
88+ __s64 total = 0 ;
89+ __s64 stop = n ;
90+ if (stop > 64 )
91+ stop = 64 ;
92+ for (__s64 idx = 0 ; idx < stop ; idx += 1 ) {
93+ __s64 i = idx ;
94+ total = total + bpf_get_prandom_u32 ();
95+ }
96+ return total ;
9797}
0 commit comments