Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Issue 123012: Implement tick events compression in a log file. (Closed)

Created:
11 years, 6 months ago by Mikhail Naganov
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Implement tick events compression in a log file. Two techniques are involved: - compress repeated line ends (common stack beginnings) by using back references; - do RLE compression of repeated tick events. This gives only 5% size reduction on benchmarks run, but this is because tick events are only comprise 10% of file size. Under Chromium winnings are bigger because long repeated samples of idleness are now compressed into a single line. Tickprocessor will be updated in the next patch. Committed: http://code.google.com/p/v8/source/detail?r=2147

Patch Set 1 #

Total comments: 13
Unified diffs Side-by-side diffs Delta from patch set Stats (+397 lines, -3 lines) Patch
M src/log.h View 2 chunks +4 lines, -0 lines 0 comments Download
M src/log.cc View 2 chunks +23 lines, -0 lines 2 comments Download
M src/log-utils.h View 3 chunks +58 lines, -0 lines 0 comments Download
M src/log-utils.cc View 4 chunks +146 lines, -0 lines 6 comments Download
M src/utils.h View 1 chunk +5 lines, -0 lines 0 comments Download
M test/cctest/test-log-utils.cc View 3 chunks +161 lines, -3 lines 5 comments Download

Messages

Total messages: 3 (0 generated)
Mikhail Naganov
11 years, 6 months ago (2009-06-11 08:00:15 UTC) #1
Søren Thygesen Gjesse
LGTM Maybe log the value of kRecordCompressorWindow when compressing (like aliases are logged) to let ...
11 years, 6 months ago (2009-06-11 11:13:56 UTC) #2
Mikhail Naganov
11 years, 6 months ago (2009-06-11 14:07:12 UTC) #3
Thanks for comments!

> Maybe log the value of kRecordCompressorWindow when compressing (like aliases
> are logged) to let the client know the maximum backreference number to expect.

Done.

> Is the handling of fields when compression actually required? Maybe the index
to
> a previous record could be a char position instead of a field position, and
then
> you can avoid the search for separators.

Yes, you're right. Initially I thought that having references to fields makes
parsing easier, but then decided that I can cope with it. And since it really
simplifies the code, I've removed it.

> Btw. have you looked into using a higher base that 16 (hex) for logging
> addresses? I think that will improve compression as well.

Instead I've implemented using offsets instead of absolute addresses wherever
possible and dropping "0x" prefix (coming in next CL). For offsets using higher
base will not win much, though.

http://codereview.chromium.org/123012/diff/1/2
File src/log-utils.cc (right):

http://codereview.chromium.org/123012/diff/1/2#newcode355
Line 355: prev_ = curr_++;
On 2009/06/11 11:13:56, Søren Gjesse wrote:
> Maybe add a comment here saying that we keep a circular bufer of the
> kRecordCompressorWindow last records.

Done.

http://codereview.chromium.org/123012/diff/1/2#newcode392
Line 392: // Compare strings backwards, stop on the last matching character.
On 2009/06/11 11:13:56, Søren Gjesse wrote:
> I am not sure how expensive this is, but perhaps comparing 4 chars at a time
> using a uint32_t pointer instead of a char pointer can make a difference, even
> though there is the edge case of moving to the first 4 byte aligned char.

I'm aware of this optimization, but don't want to introduce it. This code runs
in a separate thread, so it doesn't affect V8's performance.

http://codereview.chromium.org/123012/diff/1/2#newcode405
Line 405: && (prev_ptr != prev.start() && *(prev_ptr - 1) != kFieldSeparator
On 2009/06/11 11:13:56, Søren Gjesse wrote:
> Will prev_ptr ever become prev.start() as the do loop starts by incrementing
> prev_ptr? Maybe assert that instead.

I've removed field alignment, so this code has gone.

http://codereview.chromium.org/123012/diff/1/4
File src/log.cc (right):

http://codereview.chromium.org/123012/diff/1/4#newcode858
Line 858: ++tick_repeat_count_;
On 2009/06/11 11:13:56, Søren Gjesse wrote:
> Maybe we want to report something once in a while even if events are the same
> e.g after 1s (X repeated events depending on the sample interval)?

I think this is not needed. Overflow of a counter will only happen after about
24 days. Also, as I've noticed, in Chromium even idle application doesn't stuck
in the same place for a while. Every incoming event causes it to resume
execution, so PC or SP periodically changes.

http://codereview.chromium.org/123012/diff/1/7
File test/cctest/test-log-utils.cc (right):

http://codereview.chromium.org/123012/diff/1/7#newcode157
Line 157: void CheckCompression(LogRecordCompressor* comp,
On 2009/06/11 11:13:56, Søren Gjesse wrote:
> Not that it's a big deal, but you could use a reference parameter here.

I'm modifying Compressor's state, to I'm treating it as an input/output
parameter.

http://codereview.chromium.org/123012/diff/1/7#newcode265
Line 265: // string_1 is out of buffer by now, so it shouldn't be compressed.
On 2009/06/11 11:13:56, Søren Gjesse wrote:
> Add an assert for kRecordCompressorWindow to easily spot why this test have
> failed. E.g. make this function a friend of LogRecordCompressor and assert to
> length of the buffer.

Actually, it doesn't depend on kRecordCompressorWindow, but instead on the
parameter passed to LogRecordCompressor's constructor in this test. But I added
an assertion anyway.

Powered by Google App Engine
This is Rietveld 408576698