mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix(projects): parallelize project indexing with coroutines
This commit is contained in:
@@ -48,3 +48,21 @@ constructor(
|
||||
lastLap = System.currentTimeMillis()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the given action with a stopwatch to log the time the action took to execute.
|
||||
*
|
||||
* @see StopWatch
|
||||
*/
|
||||
inline fun <R> withStopWatch(
|
||||
label: String,
|
||||
start: Long = System.currentTimeMillis(),
|
||||
lastLap: Long = start,
|
||||
action: (StopWatch) -> R
|
||||
): R {
|
||||
return StopWatch(label, start, lastLap).run {
|
||||
action(this).also {
|
||||
log()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user