##// END OF EJS Templates
perf: add command for measuring revlog chunk operations...
perf: add command for measuring revlog chunk operations Upcoming commits will teach revlogs to leverage the new compression engine API so that new compression formats can more easily be leveraged in revlogs. We want to be sure this refactoring doesn't regress performance. So this commit introduces "perfrevchunks" to explicitly test performance of reading, decompressing, and recompressing revlog chunks. Here is output when run on the mozilla-unified repo: $ hg perfrevlogchunks -c ! read ! wall 0.346603 comb 0.350000 user 0.340000 sys 0.010000 (best of 28) ! read w/ reused fd ! wall 0.337707 comb 0.340000 user 0.320000 sys 0.020000 (best of 30) ! read batch ! wall 0.013206 comb 0.020000 user 0.000000 sys 0.020000 (best of 221) ! read batch w/ reused fd ! wall 0.013259 comb 0.030000 user 0.010000 sys 0.020000 (best of 222) ! chunk ! wall 1.909939 comb 1.910000 user 1.900000 sys 0.010000 (best of 6) ! chunk batch ! wall 1.750677 comb 1.760000 user 1.740000 sys 0.020000 (best of 6) ! compress ! wall 5.668004 comb 5.670000 user 5.670000 sys 0.000000 (best of 3) $ hg perfrevlogchunks -m ! read ! wall 0.365834 comb 0.370000 user 0.350000 sys 0.020000 (best of 26) ! read w/ reused fd ! wall 0.350160 comb 0.350000 user 0.320000 sys 0.030000 (best of 28) ! read batch ! wall 0.024777 comb 0.020000 user 0.000000 sys 0.020000 (best of 119) ! read batch w/ reused fd ! wall 0.024895 comb 0.030000 user 0.000000 sys 0.030000 (best of 118) ! chunk ! wall 2.514061 comb 2.520000 user 2.480000 sys 0.040000 (best of 4) ! chunk batch ! wall 2.380788 comb 2.380000 user 2.360000 sys 0.020000 (best of 5) ! compress ! wall 9.815297 comb 9.820000 user 9.820000 sys 0.000000 (best of 3) We already see some interesting data, such as how much slower non-batched chunk reading is and that zlib compression appears to be >2x slower than decompression. I didn't have the data when I wrote this commit message, but I ran this on Mozilla's NFS-based Mercurial server and the time for reading with a reused file descriptor was faster. So I think it is worth testing both with and without file descriptor reuse so we can make informed decisions about recycling file descriptors.

File last commit:

r29870:6d11ae3c default
r30451:94ca0e13 default
Show More
test-journal.t
241 lines | 6.5 KiB | text/troff | Tads3Lexer
Martijn Pieters
journal: new experimental extension...
r29443 Tests for the journal extension; records bookmark locations.
$ cat >> testmocks.py << EOF
> # mock out util.getuser() and util.makedate() to supply testable values
> import os
> from mercurial import util
> def mockgetuser():
> return 'foobar'
>
> def mockmakedate():
> filename = os.path.join(os.environ['TESTTMP'], 'testtime')
> try:
> with open(filename, 'rb') as timef:
> time = float(timef.read()) + 1
> except IOError:
> time = 0.0
> with open(filename, 'wb') as timef:
> timef.write(str(time))
> return (time, 0)
>
> util.getuser = mockgetuser
> util.makedate = mockmakedate
> EOF
$ cat >> $HGRCPATH << EOF
> [extensions]
> journal=
> testmocks=`pwd`/testmocks.py
> EOF
Setup repo
$ hg init repo
$ cd repo
Test empty journal
$ hg journal
Martijn Pieters
journal: add dirstate tracking...
r29502 previous locations of '.':
Martijn Pieters
journal: new experimental extension...
r29443 no recorded locations
$ hg journal foo
previous locations of 'foo':
no recorded locations
Martijn Pieters
journal: add dirstate tracking...
r29502 Test that working copy changes are tracked
$ echo a > a
$ hg commit -Aqm a
$ hg journal
previous locations of '.':
cb9a9f314b8b commit -Aqm a
$ echo b > a
$ hg commit -Aqm b
$ hg journal
previous locations of '.':
1e6c11564562 commit -Aqm b
cb9a9f314b8b commit -Aqm a
$ hg up 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg journal
previous locations of '.':
cb9a9f314b8b up 0
1e6c11564562 commit -Aqm b
cb9a9f314b8b commit -Aqm a
Martijn Pieters
journal: new experimental extension...
r29443 Test that bookmarks are tracked
$ hg book -r tip bar
$ hg journal bar
previous locations of 'bar':
1e6c11564562 book -r tip bar
$ hg book -f bar
$ hg journal bar
previous locations of 'bar':
cb9a9f314b8b book -f bar
1e6c11564562 book -r tip bar
$ hg up
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
updating bookmark bar
$ hg journal bar
previous locations of 'bar':
1e6c11564562 up
cb9a9f314b8b book -f bar
1e6c11564562 book -r tip bar
Martijn Pieters
journal: add dirstate tracking...
r29502 Test that bookmarks and working copy tracking is not mixed
$ hg journal
previous locations of '.':
1e6c11564562 up
cb9a9f314b8b up 0
1e6c11564562 commit -Aqm b
cb9a9f314b8b commit -Aqm a
Test that you can list all entries as well as limit the list or filter on them
Martijn Pieters
journal: new experimental extension...
r29443
$ hg book -r tip baz
Martijn Pieters
journal: add dirstate tracking...
r29502 $ hg journal --all
previous locations of the working copy and bookmarks:
1e6c11564562 baz book -r tip baz
1e6c11564562 bar up
1e6c11564562 . up
cb9a9f314b8b bar book -f bar
1e6c11564562 bar book -r tip bar
cb9a9f314b8b . up 0
1e6c11564562 . commit -Aqm b
cb9a9f314b8b . commit -Aqm a
Martijn Pieters
journal: new experimental extension...
r29443 $ hg journal --limit 2
Martijn Pieters
journal: add dirstate tracking...
r29502 previous locations of '.':
Martijn Pieters
journal: new experimental extension...
r29443 1e6c11564562 up
Martijn Pieters
journal: add dirstate tracking...
r29502 cb9a9f314b8b up 0
Martijn Pieters
journal: new experimental extension...
r29443 $ hg journal bar
previous locations of 'bar':
1e6c11564562 up
cb9a9f314b8b book -f bar
1e6c11564562 book -r tip bar
$ hg journal foo
previous locations of 'foo':
no recorded locations
Martijn Pieters
journal: add dirstate tracking...
r29502 $ hg journal .
previous locations of '.':
1e6c11564562 up
cb9a9f314b8b up 0
1e6c11564562 commit -Aqm b
cb9a9f314b8b commit -Aqm a
Martijn Pieters
journal: add support for seaching by pattern...
r29504 $ hg journal "re:ba."
previous locations of 're:ba.':
1e6c11564562 baz book -r tip baz
1e6c11564562 bar up
cb9a9f314b8b bar book -f bar
1e6c11564562 bar book -r tip bar
Martijn Pieters
journal: new experimental extension...
r29443
Yuya Nishihara
journal: use fm.formatlist() to pass hashes in appropriate type (BC)
r29677 Test that verbose, JSON, template and commit output work
Martijn Pieters
journal: new experimental extension...
r29443
Martijn Pieters
journal: add dirstate tracking...
r29502 $ hg journal --verbose --all
previous locations of the working copy and bookmarks:
000000000000 -> 1e6c11564562 foobar baz 1970-01-01 00:00 +0000 book -r tip baz
cb9a9f314b8b -> 1e6c11564562 foobar bar 1970-01-01 00:00 +0000 up
cb9a9f314b8b -> 1e6c11564562 foobar . 1970-01-01 00:00 +0000 up
1e6c11564562 -> cb9a9f314b8b foobar bar 1970-01-01 00:00 +0000 book -f bar
000000000000 -> 1e6c11564562 foobar bar 1970-01-01 00:00 +0000 book -r tip bar
1e6c11564562 -> cb9a9f314b8b foobar . 1970-01-01 00:00 +0000 up 0
cb9a9f314b8b -> 1e6c11564562 foobar . 1970-01-01 00:00 +0000 commit -Aqm b
000000000000 -> cb9a9f314b8b foobar . 1970-01-01 00:00 +0000 commit -Aqm a
$ hg journal --verbose -Tjson
[
{
"command": "up",
Yuya Nishihara
journal: use fm.formatdate() to pass date tuple in appropriate type (BC)
r29679 "date": [5.0, 0],
Martijn Pieters
journal: add dirstate tracking...
r29502 "name": ".",
Yuya Nishihara
journal: use fm.formatlist() to pass hashes in appropriate type (BC)
r29677 "newhashes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
"oldhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
Martijn Pieters
journal: add dirstate tracking...
r29502 "user": "foobar"
},
{
"command": "up 0",
Yuya Nishihara
journal: use fm.formatdate() to pass date tuple in appropriate type (BC)
r29679 "date": [2.0, 0],
Martijn Pieters
journal: add dirstate tracking...
r29502 "name": ".",
Yuya Nishihara
journal: use fm.formatlist() to pass hashes in appropriate type (BC)
r29677 "newhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
"oldhashes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
Martijn Pieters
journal: add dirstate tracking...
r29502 "user": "foobar"
},
{
"command": "commit -Aqm b",
Yuya Nishihara
journal: use fm.formatdate() to pass date tuple in appropriate type (BC)
r29679 "date": [1.0, 0],
Martijn Pieters
journal: add dirstate tracking...
r29502 "name": ".",
Yuya Nishihara
journal: use fm.formatlist() to pass hashes in appropriate type (BC)
r29677 "newhashes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
"oldhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
Martijn Pieters
journal: add dirstate tracking...
r29502 "user": "foobar"
},
{
"command": "commit -Aqm a",
Yuya Nishihara
journal: use fm.formatdate() to pass date tuple in appropriate type (BC)
r29679 "date": [0.0, 0],
Martijn Pieters
journal: add dirstate tracking...
r29502 "name": ".",
Yuya Nishihara
journal: use fm.formatlist() to pass hashes in appropriate type (BC)
r29677 "newhashes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
"oldhashes": ["0000000000000000000000000000000000000000"],
Martijn Pieters
journal: add dirstate tracking...
r29502 "user": "foobar"
}
]
Yuya Nishihara
journal: use fm.formatlist() to pass hashes in appropriate type (BC)
r29677
$ cat <<EOF >> $HGRCPATH
> [templates]
> j = "{oldhashes % '{node|upper}'} -> {newhashes % '{node|upper}'}
> - user: {user}
> - command: {command}
Yuya Nishihara
journal: use fm.formatdate() to pass date tuple in appropriate type (BC)
r29679 > - date: {date|rfc3339date}
Yuya Nishihara
journal: use fm.formatlist() to pass hashes in appropriate type (BC)
r29677 > - newhashes: {newhashes}
> - oldhashes: {oldhashes}
> "
> EOF
$ hg journal -Tj -l1
previous locations of '.':
CB9A9F314B8B07BA71012FCDBC544B5A4D82FF5B -> 1E6C11564562B4ED919BACA798BC4338BD299D6A
- user: foobar
- command: up
Yuya Nishihara
journal: use fm.formatdate() to pass date tuple in appropriate type (BC)
r29679 - date: 1970-01-01T00:00:05+00:00
Yuya Nishihara
journal: use fm.formatlist() to pass hashes in appropriate type (BC)
r29677 - newhashes: 1e6c11564562b4ed919baca798bc4338bd299d6a
- oldhashes: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
Martijn Pieters
journal: new experimental extension...
r29443 $ hg journal --commit
Martijn Pieters
journal: add dirstate tracking...
r29502 previous locations of '.':
Martijn Pieters
journal: new experimental extension...
r29443 1e6c11564562 up
changeset: 1:1e6c11564562
bookmark: bar
bookmark: baz
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: b
Martijn Pieters
journal: add dirstate tracking...
r29502 cb9a9f314b8b up 0
Martijn Pieters
journal: new experimental extension...
r29443 changeset: 0:cb9a9f314b8b
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
Martijn Pieters
journal: add dirstate tracking...
r29502 1e6c11564562 commit -Aqm b
Martijn Pieters
journal: new experimental extension...
r29443 changeset: 1:1e6c11564562
bookmark: bar
bookmark: baz
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: b
Martijn Pieters
journal: add dirstate tracking...
r29502 cb9a9f314b8b commit -Aqm a
changeset: 0:cb9a9f314b8b
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
Martijn Pieters
journal: new experimental extension...
r29443
Test for behaviour on unexpected storage version information
Pierre-Yves David
journal: rename on disk files to 'namejournal'...
r29870 $ printf '42\0' > .hg/namejournal
Martijn Pieters
journal: new experimental extension...
r29443 $ hg journal
Martijn Pieters
journal: add dirstate tracking...
r29502 previous locations of '.':
Martijn Pieters
journal: new experimental extension...
r29443 abort: unknown journal file version '42'
[255]
$ hg book -r tip doomed
unsupported journal file version '42'