layout: true
.header[.grey[© 2018 Vladimir Lysyy | All rights reserved]] .footer[]
class: center, middle
name: title
layout: true
.header[.grey[© 2018 Vladimir Lysyy | All rights reserved]] .footer[]
class: center, middle
name: title
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <style> | |
| @import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); | |
| @import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic); | |
| @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); | |
| body { font-family: 'Droid Serif'; } |
| #!/bin/bash | |
| # | |
| # A script to incrementally poll a log file. | |
| # Subsequent invocations print lines added since the previous invocation. | |
| # An assumption is that log lines begin with a timestamp 23 characters long (see/tweak the TS_LEN variable below). | |
| # | |
| # The state is stored in the file <original_filename>.seen as a last_line_no + last_timestamp pair last seen. | |
| # If the state file is not there, or the line_no in the target file has the last_timestamp | |
| # different from the one in the state file, then the file is printed from the line 1. |
| def timeit (warmups: Int, trials: Int) (block: => Unit): Unit = { | |
| import Math.{min,max} | |
| for (i <- 1 to warmups) block | |
| var total = 0.0 | |
| var best = Long.MaxValue | |
| var worst = Long.MinValue | |
| for (i <- 1 to trials) { | |
| val beg = System.nanoTime() |
| import static java.time.Instant.ofEpochMilli; | |
| import static System.out; | |
| class ts2dt { | |
| public static void main(String... args) { | |
| out.println(ofEpochMilli(Long.valueOf(args[0]))); | |
| } | |
| } |
| <project ...> | |
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-dependency-plugin</artifactId> | |
| <version>...</version> | |
| <executions> | |
| <execution> | |
| <id>analyze</id> |
| <project ...> | |
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-compiler-plugin</artifactId> | |
| <version>...</version> | |
| <configuration> | |
| <compilerArgs> | |
| <arg>-Xlint:all,-options,-path,-sunapi</arg> |
| import static java.lang.System.nanoTime; | |
| /* | |
| * Usage: | |
| * final long then = TimeIt.start(); | |
| * ... | |
| * final long elapsed = TimeIt.elapsedSince(then); | |
| * recorder.record(elapsed); | |
| */ | |
| public class TimeIt { |