liblogcat: measure performance

Existing dummy benchmark converted to a single-pass benchmark.

Add support for ">[filename]" interpretation in liblogcat, helpful to
provide more consistent benchmark results when sending output to
/dev/null.

NB: results are not consistent as there is a roundtrip to logd
    service, but they are indicative of better performance for
    liblogcat.

Benchmark                                Time           CPU Iterations
----------------------------------------------------------------------
BM_logcat_stat_popen_libc         35221677 ns     603314 ns        100
BM_logcat_stat_popen_liblogcat    15871805 ns     579398 ns       1287
BM_logcat_stat_system_libc        39037825 ns     319882 ns        100
BM_logcat_stat_system_liblogcat    9896755 ns     762610 ns       1310
BM_logcat_dump_popen_libc        776206254 ns  131448772 ns          5
BM_logcat_dump_popen_liblogcat   610674905 ns  118709624 ns          6
BM_logcat_dump_system_libc       512191254 ns     388724 ns         10
BM_logcat_dump_system_liblogcat  443897570 ns  377215696 ns          2

Test: logcat-benchmarks --benchmark_filter='BM_logcat_stat*|BM_logcat_dump*'
Bug: 35326290
Change-Id: Ie94900a3070487f45742f6c0789b5b3cf036df34
3 files changed