Merge branch 'fr/pack-objects-trace-pack-bytes'
The pack-objects command has been updated to record the total bytes written to pack files in trace2 output, allowing performance analysis of different compression settings by comparing the resulting pack sizes. * fr/pack-objects-trace-pack-bytes: pack-objects: trace pack bytes writtenmain
commit
6e75a57d1b
|
|
@ -1338,6 +1338,7 @@ static void write_pack_file(void)
|
||||||
uint32_t nr_remaining = nr_result;
|
uint32_t nr_remaining = nr_result;
|
||||||
time_t last_mtime = 0;
|
time_t last_mtime = 0;
|
||||||
struct object_entry **write_order;
|
struct object_entry **write_order;
|
||||||
|
off_t bytes_written = 0;
|
||||||
|
|
||||||
if (progress > pack_to_stdout)
|
if (progress > pack_to_stdout)
|
||||||
progress_state = start_progress(the_repository,
|
progress_state = start_progress(the_repository,
|
||||||
|
|
@ -1390,6 +1391,8 @@ static void write_pack_file(void)
|
||||||
display_progress(progress_state, written);
|
display_progress(progress_state, written);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bytes_written += hashfile_total(f) +
|
||||||
|
the_repository->hash_algo->rawsz;
|
||||||
if (pack_to_stdout) {
|
if (pack_to_stdout) {
|
||||||
/*
|
/*
|
||||||
* We never fsync when writing to stdout since we may
|
* We never fsync when writing to stdout since we may
|
||||||
|
|
@ -1511,6 +1514,8 @@ static void write_pack_file(void)
|
||||||
written, nr_result);
|
written, nr_result);
|
||||||
trace2_data_intmax("pack-objects", the_repository,
|
trace2_data_intmax("pack-objects", the_repository,
|
||||||
"write_pack_file/wrote", nr_result);
|
"write_pack_file/wrote", nr_result);
|
||||||
|
trace2_data_intmax("pack-objects", the_repository,
|
||||||
|
"write_pack_file/wrote_bytes", bytes_written);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int no_try_delta(const char *path)
|
static int no_try_delta(const char *path)
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,30 @@ test_expect_success 'setup' '
|
||||||
} >expect
|
} >expect
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'pack-object traces bytes written to stdout' '
|
||||||
|
test_when_finished "rm -f pack.trace pack.pack" &&
|
||||||
|
GIT_TRACE2_EVENT="$PWD/pack.trace" \
|
||||||
|
git pack-objects --quiet --revs --stdout >pack.pack <<-EOF &&
|
||||||
|
$commit
|
||||||
|
EOF
|
||||||
|
bytes=$(test_file_size pack.pack) &&
|
||||||
|
test_grep "\"key\":\"write_pack_file/wrote_bytes\",\"value\":\"$bytes\"" pack.trace
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'pack-object traces bytes written to split pack files' '
|
||||||
|
test_when_finished "rm -f split.trace traced-pack-*" &&
|
||||||
|
GIT_TRACE2_EVENT="$PWD/split.trace" \
|
||||||
|
git -c pack.packSizeLimit=3m pack-objects --quiet traced-pack <obj-list &&
|
||||||
|
test 2 = $(ls traced-pack-*.pack | wc -l) &&
|
||||||
|
bytes=0 &&
|
||||||
|
for pack in traced-pack-*.pack
|
||||||
|
do
|
||||||
|
pack_size=$(test_file_size "$pack") &&
|
||||||
|
bytes=$((bytes + pack_size)) || return 1
|
||||||
|
done &&
|
||||||
|
test_grep "\"key\":\"write_pack_file/wrote_bytes\",\"value\":\"$bytes\"" split.trace
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'setup pack-object <stdin' '
|
test_expect_success 'setup pack-object <stdin' '
|
||||||
git init pack-object-stdin &&
|
git init pack-object-stdin &&
|
||||||
test_commit -C pack-object-stdin one &&
|
test_commit -C pack-object-stdin one &&
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue