Confirmed users
975
edits
(→Timestamp benchmark: Use syntax highlighting for simple timestamp benchmark example) |
|||
| Line 59: | Line 59: | ||
A timestamp benchmark is a manual test where a developer adds temporary code to log the duration they want to measure and then performs the use case on the device themselves to get the values printed. Here's an example of a simple use case: | A timestamp benchmark is a manual test where a developer adds temporary code to log the duration they want to measure and then performs the use case on the device themselves to get the values printed. Here's an example of a simple use case: | ||
<syntaxhighlight lang="kotlin"> | |||
val start = SystemClock.elapsedRealtime() | |||
thingWeWantToMeasure() | |||
val end = SystemClock.elapsedRealtime() | |||
Log.e("benchmark", "${end - start}") // result is in milliseconds | |||
</syntaxhighlight> | |||
Like automated benchmarks, these tests can accurately measure what users experience. However, they are fairly quick to write and execute but are tedious and time-consuming to carry out and have many places to introduce errors. | Like automated benchmarks, these tests can accurately measure what users experience. However, they are fairly quick to write and execute but are tedious and time-consuming to carry out and have many places to introduce errors. | ||