10 std::vector<std::string>
ParseStringList(
const std::string& inputString,
const char* delimiter)
12 std::stringstream stream(inputString);
13 return ParseArrayImpl<std::string>(stream, [](
const std::string& s) {
18 const double& thresholdTime)
20 ARMNN_LOG(info) <<
"Inference time: " << std::setprecision(2)
21 << std::fixed << duration.count() <<
" ms\n";
23 if (thresholdTime != 0.0)
25 ARMNN_LOG(info) <<
"Threshold time: " << std::setprecision(2)
26 << std::fixed << thresholdTime <<
" ms";
27 auto thresholdMinusInference = thresholdTime - duration.count();
28 ARMNN_LOG(info) <<
"Threshold time - Inference time: " << std::setprecision(2)
29 << std::fixed << thresholdMinusInference <<
" ms" <<
"\n";
30 if (thresholdMinusInference < 0)
32 std::string errorMessage =
"Elapsed inference time is greater than provided threshold time.";
42 if (!fs::exists(file))
44 std::cerr <<
"Given file path '" << file <<
"' does not exist" << std::endl;
47 if (!fs::is_regular_file(file) && expectFile)
49 std::cerr <<
"Given file path '" << file <<
"' is not a regular file" << std::endl;
55 std::vector<unsigned int>
ParseArray(std::istream& stream)
57 return ParseArrayImpl<unsigned int>(
62 bool ValidatePaths(
const std::vector<std::string>& fileVec,
const bool expectFile)
64 bool allPathsValid =
true;
65 for (
auto const& file : fileVec)
69 allPathsValid =
false;
void LogAndThrow(std::string eMsg)
std::vector< unsigned int > ParseArray(std::istream &stream)
std::vector< std::string > ParseStringList(const std::string &inputString, const char *delimiter)
Splits a given string at every accurance of delimiter into a vector of string.
#define ARMNN_LOG(severity)
std::string StringTrimCopy(const std::string &str, const std::string &chars="\\\")
Trim from both the start and the end of a string, returns a trimmed copy of the string.
bool ValidatePaths(const std::vector< std::string > &fileVec, const bool expectFile)
Verifies if a given vector of strings are valid paths.
Base class for all ArmNN exceptions so that users can filter to just those.
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
bool CheckInferenceTimeThreshold(const std::chrono::duration< double, std::milli > &duration, const double &thresholdTime)
Given a measured duration and a threshold time tell the user whether we succeeded or not...
bool ValidatePath(const std::string &file, const bool expectFile)
Verifies if the given string is a valid path.