Add ComputeBudget tuner (#12476)

This commit is contained in:
Jack May
2020-09-25 09:01:22 -07:00
committed by GitHub
parent b8c4b88188
commit d326512121
6 changed files with 115 additions and 5 deletions

View File

@@ -0,0 +1,23 @@
/**
* @brief Compute budget tuner program. Spins in a loop consuming the entire
* budget, used by the tuner bench test to tune the compute budget costs.
*
* Care should be taken because the compiler might optimize out the mechanism
* you are trying to tune.
*/
#include <solana_sdk.h>
extern uint64_t entrypoint(const uint8_t *input) {
uint8_t *val = (uint8_t *)input;
for (uint64_t i = 0; i < UINT64_MAX; i++) {
// Uncomment for raw compute
{
if (*val != 0) {
*val = *val + 1;
}
}
}
return *val;
}