Flutter Engine
The Flutter Engine
Functions
Timer.h File Reference
#include "include/core/SkString.h"

Go to the source code of this file.

Functions

SkString HumanizeMs (double)
 

Function Documentation

◆ HumanizeMs()

SkString HumanizeMs ( double  ms)

Definition at line 9 of file Timer.cpp.

9 {
10 if (ms > 60e+3) return SkStringPrintf("%.3gm", ms/60e+3);
11 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e+3);
12 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e+6);
13#ifdef SK_BUILD_FOR_WIN
14 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e+3);
15#else
16 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e+3);
17#endif
18 return SkStringPrintf("%.3gms", ms);
19}
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.