vishna
07/24/2019, 9:01 AMNikky
07/24/2019, 9:45 AMvishna
07/24/2019, 10:15 AMNikky
07/25/2019, 8:11 AMvishna
07/25/2019, 9:19 AMvishna
07/25/2019, 9:27 AM./gradlew build
- unit tests should generate those timings for you:
https://github.com/eyeem/watch-a-doin/blob/master/src/test/kotlin/com/eyeem/watchadoin/WatchadoinTest.ktNikky
07/25/2019, 11:46 AMfun Stopwatch.child(name: String): Stopwatch {
val childStopwatch = Stopwatch(name)
children.add(childStopwatch)
return childStopwatch
}
inline fun <T> Stopwatch.child(name: String, block: Stopwatch.() -> T) : T {
val childStopwatch = Stopwatch(name)
children.add(childStopwatch)
with(childStopwatch) {
start()
val t = childStopwatch.block()
end()
return t
}
}
and then wrapping single calls or the body of loops or such with watch.child("childname") { }
and then pass through this
as the Stopwatch param to any functions in thereNikky
07/25/2019, 11:58 AMthis
?vishna
07/25/2019, 12:14 PMchild
method just like yours, then changed it to get operator
but finally decided to removed it to āforceā creating children within the parentās context by design - otherwise at some point it was getting confusing who is the owner of the children.
String.watch
returns Stopwatch instance, so in theory you can use that to create watch within parentās context but you can keep reference around if you need to do something non-standard, e.g.:
https://gist.github.com/vishna/691020e9db807efd0a0933a4e3d6c01e#file-loopwatch_5-ktNikky
07/25/2019, 12:16 PMNikky
07/25/2019, 12:16 PMNikky
07/25/2019, 12:17 PMNikky
07/25/2019, 12:18 PMNikky
07/25/2019, 12:20 PMNikky
07/25/2019, 12:21 PMfun doExpensiveWork(stopwatch: Stopwatch) = stopwatch {....}
Nikky
07/25/2019, 12:21 PMNikky
07/25/2019, 12:23 PMvishna
07/25/2019, 12:23 PMvishna
07/25/2019, 12:24 PMvishna
07/25/2019, 12:29 PMNikky
07/25/2019, 12:31 PMval tomeWatch = "initTome".watch
val tomeEnv = initTome(
stopwatch = tomeWatch, libs = libs, host = host, tomeDir = tomeDir, docDir = docDir
)
tomeWatch.end()
Nikky
07/25/2019, 12:31 PM= stopwatch {}
and afaik invoke calls end() alreadyNikky
07/25/2019, 12:32 PMvishna
07/25/2019, 12:36 PMNikky
07/25/2019, 12:38 PMstart
, block
and end
i think i might now the issue.. some child watch might not end properlyNikky
07/25/2019, 12:38 PMvishna
07/25/2019, 12:39 PMNikky
07/25/2019, 12:40 PMvishna
07/25/2019, 12:41 PMNikky
07/25/2019, 12:43 PMBasicScriptingHost#eval
somehow runs into issuesNikky
07/25/2019, 12:47 PMNikky
07/25/2019, 12:47 PMvishna
07/25/2019, 12:48 PMvishna
07/25/2019, 12:49 PMNikky
07/25/2019, 12:50 PMNikky
07/25/2019, 12:51 PMvishna
07/25/2019, 12:54 PMvishna
07/25/2019, 12:55 PMvishna
07/25/2019, 12:56 PMNikky
07/25/2019, 12:57 PMNikky
07/25/2019, 12:57 PMNikky
07/25/2019, 12:58 PMNikky
07/25/2019, 1:04 PMvishna
07/25/2019, 1:06 PMvishna
07/25/2019, 1:06 PMvishna
07/25/2019, 1:09 PMNikky
07/25/2019, 1:50 PMlaunch
and it completels before the inner ones, not obvious on first glance but very obvious on second one, luckily it was easy to find since the library tells me which watch acts upNikky
07/25/2019, 1:51 PMvishna
07/25/2019, 1:53 PMvishna
07/25/2019, 1:54 PMvishna
07/25/2019, 1:54 PMvishna
07/25/2019, 1:56 PMNikky
07/25/2019, 1:56 PMvishna
07/25/2019, 1:58 PMNikky
07/25/2019, 1:59 PMNikky
07/25/2019, 1:59 PMNikky
07/25/2019, 2:03 PMNikky
07/25/2019, 2:04 PMvishna
07/25/2019, 2:06 PMNikky
07/25/2019, 2:12 PMNikky
07/25/2019, 2:15 PMvishna
07/25/2019, 2:16 PMNikky
07/25/2019, 2:26 PMNikky
07/25/2019, 2:27 PMNikky
07/25/2019, 2:30 PMvishna
07/25/2019, 2:31 PM./gradlew clean build --refresh-dependencies
should usually do itNikky
07/25/2019, 2:31 PMNikky
07/25/2019, 2:31 PMvishna
07/25/2019, 2:33 PMvishna
07/25/2019, 2:33 PMNikky
07/25/2019, 2:41 PMNikky
07/25/2019, 2:41 PMNikky
07/25/2019, 2:41 PMvishna
07/25/2019, 2:44 PMvishna
07/25/2019, 2:45 PMvishna
07/25/2019, 2:46 PMNikky
07/25/2019, 2:52 PMNikky
07/25/2019, 2:52 PMNikky
07/25/2019, 3:13 PMNikky
07/25/2019, 3:36 PMNikky
07/25/2019, 3:36 PMhttps://cdn.discordapp.com/attachments/460158280812068864/603973806855553062/unknown.pngā¾
vishna
07/25/2019, 4:22 PM