int pmParseUnitsStr(const char * string , struct pmUnits * out , double * outMult , char ** errMsg );
This function expects to be called with the unit/scale specification as string . This specification takes the general form produced by pmUnitsStr . Briefly, the format allows / -separated divisor and dividend, each listing space-separated dimensions/scales along the space, time, and count axes. There are also a few extra possibilities:
First, multiple equivalent sets of keywords are accepted for the time & space dimensions, insensitive to case. For example, "microseconds", "microsecond", "microsec", "us" are considered synonymous, as are "kilobytes", "KB", "kiloByte", and so on.
Second, units may be offered in any order, e.g., ms kb count x 10^3 or count x 10^3 kb ms . They may not be repeated within the denominator or within the numerator. Each scale/unit keyword may be immediately followed by positive or negative exponents, e.g., ^-4 .
Third, numerical scaling factors may be supplied. These are factored together with implicit scale conversions into the final outMult result.
The out and outMult values must both be allocated before calling pmParseUnitsStr . If the conversion is successful, pmParseUnitsStr returns 0, and fills in out and outMult with the unit/scales defined by the input parameter. If the argument strings could not be parsed, it returns a negative status code.