Skip to content

Commit

Permalink
stress-ng: add --permute N option, run permutations of stressors
Browse files Browse the repository at this point in the history
stress-ng --with cpu,nop,vm --permute 8 will work through all the
permutation of the 3 stressors running 8 instances of each stressor
in each run. This cannot be used with --seq or --all option.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
  • Loading branch information
ColinIanKing committed Aug 5, 2023
1 parent 0b37b1e commit 7fcc02b
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 91 deletions.
18 changes: 18 additions & 0 deletions core-bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,24 @@ static inline uint32_t OPTIMIZE3 stress_bitreverse32(const uint32_t val)
#endif
}

/*
* stress_popcount64()
* population count (count number of 1 bits) in a uint64_t value
*/
static inline uint32_t OPTIMIZE3 stress_popcount64(const uint64_t val)
{
#if defined(HAVE_BUILTIN_POPCOUNT)
return (uint32_t)__builtin_popcountll(val);
#else
/* Brian Kernighan's count bits */
register uint64_t j, v = val;

for (j = 0; v; j++)
v &= v - 1;
return j;
#endif
}

/*
* stress_popcount32()
* population count (count number of 1 bits) in a uint32_t value
Expand Down
6 changes: 6 additions & 0 deletions stress-ng.1
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ with Linux 4.7 one needs to have CAP_SYS_ADMIN capabilities for this
option to work, or adjust /proc/sys/kernel/perf_event_paranoid to below
2 to use this without CAP_SYS_ADMIN.
.TP
.B \-\-permute N
run all permutations of the selected stressors with N instances of the
permutated stressors per run. If N is less than zero, then the number
of CPUs online is used for the number of instances. If N is zero, then
the number of configured CPUs in the system is used.
.TP
.B \-q, \-\-quiet
do not show any output.
.TP
Expand Down
Loading

0 comments on commit 7fcc02b

Please sign in to comment.