in BenchmarkNdkSample/benchmark/cpp/googlebenchmarkrunner/googlebenchmarkrunner.cpp [88:105]
void getBenchmarks(std::vector<std::string>* output) {
int argc = 2;
const char* argv[] = { "ignored", "--benchmark_list_tests=true" };
::benchmark::Initialize(&argc, (char**) argv);
// capture list of benchmarks in outStream
NoopReporter reporter;
std::ostringstream outStream;
reporter.SetOutputStream(&outStream);
::benchmark::RunSpecifiedBenchmarks(&reporter);
// convert to vector<string>
std::istringstream stream(outStream.str());
std::string currentBenchmarkName;
while (std::getline(stream, currentBenchmarkName)) {
output->push_back(currentBenchmarkName);
}
}