{"thread":{"id":"50906","subject":"[RFC PATCH] pack-objects: write objects packed to trace2","startedAt":"2019-04-09T21:44:26Z","lastAt":"2019-04-11T17:36:32Z","messageCount":5,"participants":["Jonathan Tan","Junio C Hamano","Duy Nguyen","Jeff Hostetler"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"373536","messageId":"20190409214420.90898-1-jonathantanmy@google.com","threadId":"50906","inReplyTo":null,"subject":"[RFC PATCH] pack-objects: write objects packed to trace2","fromName":"Jonathan Tan","fromEmail":"jonathantanmy@google.com","sentAt":"2019-04-09T21:44:20Z","receivedAt":"2019-04-09T21:44:26Z","isPatch":true,"sender":{"key":"jonathantanmy@fastmail.com","avatar":null},"body":"This is useful when investigating performance of pushes, and other times\nwhen no progress information is written (because the pack is written to\nstdout).\n\nSigned-off-by: Jonathan Tan <jonathantanmy@google.com>\n---\nWe're trying to improve push performance, and it would be nice to be\nable to observe the number of objects sent over each push, both to\ncorrelate it with time taken (which is already traced) and to notice\nsituations when significantly more objects are being sent than needed.\n\nSending this as an RFC because this patch works but is somewhat ad-hoc -\nperhaps someone else has a more comprehensive solution.\n---\n builtin/pack-objects.c | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex a154fc29f6..ac464d7d07 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -964,6 +964,7 @@ static void write_pack_file(void)\n \tif (written != nr_result)\n \t\tdie(_(\"wrote %\"PRIu32\" objects while expecting %\"PRIu32),\n \t\t    written, nr_result);\n+\ttrace2_printf(\"packed %d objects\", nr_result);\n }\n \n static int no_try_delta(const char *path)\n-- \n2.21.0.392.gf8f6787159e-goog\n\n"},{"id":"373566","messageId":"xmqqzhoy1pqn.fsf@gitster-ct.c.googlers.com","threadId":"50906","inReplyTo":"20190409214420.90898-1-jonathantanmy@google.com","subject":"Re: [RFC PATCH] pack-objects: write objects packed to trace2","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-04-10T03:52:16Z","receivedAt":"2019-04-10T03:52:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Tan <jonathantanmy@google.com> writes:\n\n> This is useful when investigating performance of pushes, and other times\n> when no progress information is written (because the pack is written to\n> stdout).\n>\n> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>\n> ---\n> We're trying to improve push performance, and it would be nice to be\n> able to observe the number of objects sent over each push, both to\n> correlate it with time taken (which is already traced) and to notice\n> situations when significantly more objects are being sent than needed.\n\nThanks---I find it a laudable goal, too.\n"},{"id":"373569","messageId":"CACsJy8CV-NxoapFcedNpCiahS3jrsWL00v2JfZkGzsrPNDmiaA@mail.gmail.com","threadId":"50906","inReplyTo":"20190409214420.90898-1-jonathantanmy@google.com","subject":"Re: [RFC PATCH] pack-objects: write objects packed to trace2","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2019-04-10T05:08:51Z","receivedAt":"2019-04-10T05:09:19Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, Apr 10, 2019 at 4:45 AM Jonathan Tan <jonathantanmy@google.com> wrote:\n>\n> This is useful when investigating performance of pushes, and other times\n> when no progress information is written (because the pack is written to\n> stdout).\n>\n> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>\n> ---\n> We're trying to improve push performance, and it would be nice to be\n> able to observe the number of objects sent over each push, both to\n> correlate it with time taken (which is already traced) and to notice\n> situations when significantly more objects are being sent than needed.\n>\n> Sending this as an RFC because this patch works but is somewhat ad-hoc -\n> perhaps someone else has a more comprehensive solution.\n> ---\n>  builtin/pack-objects.c | 1 +\n>  1 file changed, 1 insertion(+)\n>\n> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\n> index a154fc29f6..ac464d7d07 100644\n> --- a/builtin/pack-objects.c\n> +++ b/builtin/pack-objects.c\n> @@ -964,6 +964,7 @@ static void write_pack_file(void)\n>         if (written != nr_result)\n>                 die(_(\"wrote %\"PRIu32\" objects while expecting %\"PRIu32),\n>                     written, nr_result);\n> +       trace2_printf(\"packed %d objects\", nr_result);\n\nThe die() line right above uses %PRIu32 instead of %d\n\n>  }\n>\n>  static int no_try_delta(const char *path)\n> --\n> 2.21.0.392.gf8f6787159e-goog\n>\n\n\n-- \nDuy\n"},{"id":"373583","messageId":"15ec5048-d062-7011-b207-ad9c8dbe29cd@jeffhostetler.com","threadId":"50906","inReplyTo":"20190409214420.90898-1-jonathantanmy@google.com","subject":"Re: [RFC PATCH] pack-objects: write objects packed to trace2","fromName":"Jeff Hostetler","fromEmail":"git@jeffhostetler.com","sentAt":"2019-04-10T15:05:38Z","receivedAt":"2019-04-10T15:05:42Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"\n\nOn 4/9/2019 5:44 PM, Jonathan Tan wrote:\n> This is useful when investigating performance of pushes, and other times\n> when no progress information is written (because the pack is written to\n> stdout).\n> \n> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>\n> ---\n> We're trying to improve push performance, and it would be nice to be\n> able to observe the number of objects sent over each push, both to\n> correlate it with time taken (which is already traced) and to notice\n> situations when significantly more objects are being sent than needed.\n> \n> Sending this as an RFC because this patch works but is somewhat ad-hoc -\n> perhaps someone else has a more comprehensive solution.\n> ---\n>   builtin/pack-objects.c | 1 +\n>   1 file changed, 1 insertion(+)\n> \n> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\n> index a154fc29f6..ac464d7d07 100644\n> --- a/builtin/pack-objects.c\n> +++ b/builtin/pack-objects.c\n> @@ -964,6 +964,7 @@ static void write_pack_file(void)\n>   \tif (written != nr_result)\n>   \t\tdie(_(\"wrote %\"PRIu32\" objects while expecting %\"PRIu32),\n>   \t\t    written, nr_result);\n> +\ttrace2_printf(\"packed %d objects\", nr_result);\n\nFor a simple field like this, you might want to use:\n\n\ttrace2_data_intmax(\"pack-objects\", the_repository,\n\t\t\t   \"write_pack_file/wrote\", nr_result);\n\nThis will give your message visibility in both the perf and event\ntargets.  The latter makes it easier for post-processing.\n\njeff\n\n\n"},{"id":"373670","messageId":"20190411173626.61561-1-jonathantanmy@google.com","threadId":"50906","inReplyTo":"20190409214420.90898-1-jonathantanmy@google.com","subject":"[PATCH v2] pack-objects: write objects packed to trace2","fromName":"Jonathan Tan","fromEmail":"jonathantanmy@google.com","sentAt":"2019-04-11T17:36:26Z","receivedAt":"2019-04-11T17:36:32Z","isPatch":true,"sender":{"key":"jonathantanmy@fastmail.com","avatar":null},"body":"This is useful when investigating performance of pushes, and other times\nwhen no progress information is written (because the pack is written to\nstdout).\n\nSigned-off-by: Jonathan Tan <jonathantanmy@google.com>\n---\nThanks, Duy and Jeff for your comments. I've switched to Jeff's\nsuggestion (trace2_data_intmax), which also sidesteps Duy's concern\nabout PRIu32 vs %d.\n\nAs far as I can tell, with this change, the Git invocation needing to be\ntraced must be run with GIT_TR2_EVENT instead of GIT_TR2, but that's\nfine.\n---\n builtin/pack-objects.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex a154fc29f6..3326aeb497 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -964,6 +964,8 @@ static void write_pack_file(void)\n \tif (written != nr_result)\n \t\tdie(_(\"wrote %\"PRIu32\" objects while expecting %\"PRIu32),\n \t\t    written, nr_result);\n+\ttrace2_data_intmax(\"pack-objects\", the_repository,\n+\t\t\t   \"write_pack_file/wrote\", nr_result);\n }\n \n static int no_try_delta(const char *path)\n-- \n2.21.0.392.gf8f6787159e-goog\n\n"}]}