@@ -43,6 +43,7 @@ import java.io.DataInput
4343import java.io.DataOutput
4444import java.util.Collections
4545import kotlin.coroutines.coroutineContext
46+ import kotlin.time.measureTimedValue
4647
4748private val contentRootPathProvider = CopyContentRootPathProvider ()
4849
@@ -227,12 +228,11 @@ class DefaultCodeWhispererFileContextProvider(private val project: Project) : Fi
227228
228229 val contexts = withContext(coroutineContext) {
229230 val projectContextDeferred1 = async {
230- val t0 = System .currentTimeMillis()
231- val codemapContext = fetchProjectContext(query, psiFile, targetContext)
232- val t1 = System .currentTimeMillis()
231+ val timedCodemapContext = measureTimedValue { fetchProjectContext(query, psiFile, targetContext) }
232+ val codemapContext = timedCodemapContext.value
233233 LOG .debug {
234234 buildString {
235- append(" time elapse for fetching project context=${t1 - t0 } ms; " )
235+ append(" time elapse for fetching project context=${timedCodemapContext.duration.inWholeMilliseconds } ms; " )
236236 append(" numberOfChunks=${codemapContext.contents.size} ; " )
237237 append(" totalLength=${codemapContext.contentLength} " )
238238 }
@@ -242,12 +242,11 @@ class DefaultCodeWhispererFileContextProvider(private val project: Project) : Fi
242242 }
243243
244244 val openTabsContextDeferred1 = async {
245- val t0 = System .currentTimeMillis()
246- val opentabContext = fetchOpenTabsContext(query, psiFile, targetContext)
247- val t1 = System .currentTimeMillis()
245+ val timedOpentabContext = measureTimedValue { fetchOpenTabsContext(query, psiFile, targetContext) }
246+ val opentabContext = timedOpentabContext.value
248247 LOG .debug {
249248 buildString {
250- append(" time elapse for open tabs context=${t1 - t0 } ms; " )
249+ append(" time elapse for open tabs context=${timedOpentabContext.duration.inWholeMilliseconds } ms; " )
251250 append(" numberOfChunks=${opentabContext.contents.size} ; " )
252251 append(" totalLength=${opentabContext.contentLength} " )
253252 }
0 commit comments