History

perf, x86: Implement event scheduler helper functions

This patch introduces x86 perf scheduler code helper functions. We need this to later add more complex functionality to support overlapping counter constraints (next patch). The algorithm is modified so that the range of weight values is now generated from the constraints. There shouldn't be other functional changes. With the helper functions the scheduler is controlled. There are functions to initialize, traverse the event list, find unused counters etc. The scheduler keeps its own state. V3: * Added macro for_each_set_bit_cont(). * Changed functions interfaces of perf_sched_find_counter() and perf_sched_next_event() to use bool as return value. * Added some comments to make code better understandable. V4: * Fix broken event assignment if weight of the first event is not wmin (perf_sched_init()).

Robert Richter committed 15 years ago

Commit 1e2ad281 parent 0f5a2602 files · +140 −55Browse files

Showing the changes to include/linux/bitops.h (1 of 2 files). Show all

Unified · Split

include/linux/bitops.h+8−2
@@ -22,8 +22,14 @@ extern unsigned long __sw_hweight64(__u64 w); · 21 unmodified lines
2222 #include <asm/bitops.h>
2323
2424 #define for_each_set_bit(bit, addr, size) \
25− for ((bit) = find_first_bit((addr), (size)); \
26− (bit) < (size); \
25+ for ((bit) = find_first_bit((addr), (size)); \
26+ (bit) < (size); \
27+ (bit) = find_next_bit((addr), (size), (bit) + 1))
28+
29+/* same as for_each_set_bit() but use bit as value to start with */
30+#define for_each_set_bit_cont(bit, addr, size) \
31+ for ((bit) = find_next_bit((addr), (size), (bit)); \
32+ (bit) < (size); \
2733 (bit) = find_next_bit((addr), (size), (bit) + 1))
2834
2935 static __inline__ int get_bitmask_order(unsigned int count)