wrench::UnitParser
-
class UnitParser
A class used to part string specification of values with units into a single value (e.g., “2KiB” -> 2048 bytes, “1h” -> 3600 seconds). It supports all the SimGrid-supported units.
Public Static Functions
-
static double parse_bandwidth(const std::string &string)
Given a string bandwidth specification with units (e.g., “3Mbps”, “40MiBps”) return the size in bytes.
- Parameters:
string – the bandwidth specification
- Returns:
the bandwidth in byte/sec
-
static double parse_compute_speed(const std::string &string)
Given a string compute speed specification with units (e.g., “3f”, “10Gf”) return the size in bytes.
- Parameters:
string – the size specification
- Returns:
the size in bytes
-
static sg_size_t parse_size(const std::string &string)
Given a string size specification with units (e.g., “13Mb”) return the size in bytes.
- Parameters:
string – the size specification
- Returns:
the size in bytes
-
static double parse_time(const std::string &string)
Given a string time with units (e.g., “10us”, “10ms”) return the time in seconds.
- Parameters:
string – the time specification
- Returns:
the time in second
-
static double parse_bandwidth(const std::string &string)