xref: /linux/tools/perf/tests/workloads/code_with_type.rs (revision c7decec2f2d2ab0366567f9e30c0e1418cece43f)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 // We're going to look for this structure in the data type profiling report
4 #[allow(dead_code)]
5 struct Buf {
6     data1: u64,
7     data2: String,
8     data3: u64,
9 }
10 
11 #[no_mangle]
test_rs(count: u32)12 pub extern "C" fn test_rs(count: u32) {
13     let mut b = Buf {
14         data1: 0,
15         data2: String::from("data"),
16         data3: 0,
17     };
18 
19     for _ in 1..count {
20         b.data1 += 1;
21         if b.data1 == 123 {
22             b.data1 += 1;
23         }
24 
25         b.data3 += b.data1;
26     }
27 }
28