10 #include <boost/functional/hash.hpp>
11 #include <boost/version.hpp>
22 namespace fs = std::filesystem;
25 return path.rfind(
"/usr", 0) == 0 || path.rfind(
"/lib", 0) == 0;
72 const std::map<std::string,std::string>&
attributes()
const {
81 BENCHMAX_LOG_WARN(
"benchmax.tool",
"Determining dependencies using " << ss.str());
85 std::vector<std::string> results;
86 std::regex regex(
"\\t(.+) => (.+) \\([0-9a-fx]+\\)\\n");
87 auto reBegin = std::sregex_iterator(output.begin(), output.end(), regex);
88 auto reEnd = std::sregex_iterator();
89 for (
auto i = reBegin; i != reEnd; ++i) {
90 std::string lib = (*i)[1];
91 std::string path = (*i)[2];
92 if (path ==
"not found") {
96 BENCHMAX_LOG_TRACE(
"benchmax.tool",
"Found dependency " << lib <<
" (" << path <<
")");
97 results.emplace_back(path);
99 BENCHMAX_LOG_TRACE(
"benchmax.tool",
"Skipping system library " << lib <<
" (" << path <<
")");
105 BENCHMAX_LOG_WARN(
"benchmax.tool",
"Could not determine dependencies of binary");
115 boost::hash_combine(res, it.first);
116 boost::hash_combine(res, it.second);
126 virtual std::string
getCommandline(
const std::string& file,
const std::string& localBinary)
const {
127 return localBinary +
" " +
mArguments +
" " + file;
133 if (std::regex_match(cmdline, match, regex)) {
134 assert (match.size() == 2);
135 return match[1].str();
157 return os << tool.
binary().native();
#define BENCHMAX_LOG_WARN(channel, msg)
Log warnings.
#define BENCHMAX_LOG_TRACE(channel, msg)
Log trace messages.
int call_program(const std::string &commandline, std::string &stdout, bool print_to_stdout=false)
Runs an external program from some command line and records the output to stdout.
bool is_system_lib(std::string path)
std::ostream & operator<<(std::ostream &os, const BenchmarkResult &results)
Streaming operator for BenchmarkResult.
Results for a single benchmark run.