1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_BLOCK_RANGE_H
3 #define __PERF_BLOCK_RANGE_H
8 * struct block_range - non-overlapping parts of basic blocks
10 * @start: inclusive start of range
11 * @end: inclusive end of range
12 * @is_target: @start is a jump target
13 * @is_branch: @end is a branch instruction
14 * @coverage: number of blocks that cover this range
15 * @taken: number of times the branch is taken (requires @is_branch)
16 * @pred: number of times the taken branch was predicted
26 int is_target
, is_branch
;
34 static inline struct block_range
*block_range__next(struct block_range
*br
)
36 struct rb_node
*n
= rb_next(&br
->node
);
39 return rb_entry(n
, struct block_range
, node
);
42 struct block_range_iter
{
43 struct block_range
*start
;
44 struct block_range
*end
;
47 static inline struct block_range
*block_range_iter(struct block_range_iter
*iter
)
52 static inline bool block_range_iter__next(struct block_range_iter
*iter
)
54 if (iter
->start
== iter
->end
)
57 iter
->start
= block_range__next(iter
->start
);
61 static inline bool block_range_iter__valid(struct block_range_iter
*iter
)
63 if (!iter
->start
|| !iter
->end
)
68 extern struct block_range
*block_range__find(u64 addr
);
69 extern struct block_range_iter
block_range__create(u64 start
, u64 end
);
70 extern double block_range__coverage(struct block_range
*br
);
72 #endif /* __PERF_BLOCK_RANGE_H */