From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Ben Peart <peartben@gmail.com>
Cc: git@vger.kernel.org, benpeart@microsoft.com
Subject: Re: [PATCH v1] mem_pool: add GIT_TRACE_MEMPOOL support
Date: Wed, 28 Nov 2018 10:37:36 +0100 (STD) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.1811281036300.41@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20181127195337.3264-1-peartben@gmail.com>
Hi Ben,
On Tue, 27 Nov 2018, Ben Peart wrote:
> From: Ben Peart <benpeart@microsoft.com>
>
> Add tracing around initializing and discarding mempools. In discard report
> on the amount of memory unused in the current block to help tune setting
> the initial_size.
>
> Signed-off-by: Ben Peart <benpeart@microsoft.com>
> ---
Looks good.
My only question: should we also trace calls to _alloc(), _calloc() and
_combine()?
Ciao,
Johannes
>
> Notes:
> Base Ref: * git-trace-mempool
> Web-Diff: https://github.com/benpeart/git/commit/9ac84bbca2
> Checkout: git fetch https://github.com/benpeart/git git-trace-mempool-v1 && git checkout 9ac84bbca2
>
> mem-pool.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/mem-pool.c b/mem-pool.c
> index a2841a4a9a..065389aaec 100644
> --- a/mem-pool.c
> +++ b/mem-pool.c
> @@ -5,6 +5,7 @@
> #include "cache.h"
> #include "mem-pool.h"
>
> +static struct trace_key trace_mem_pool = TRACE_KEY_INIT(MEMPOOL);
> #define BLOCK_GROWTH_SIZE 1024*1024 - sizeof(struct mp_block);
>
> /*
> @@ -48,12 +49,16 @@ void mem_pool_init(struct mem_pool **mem_pool, size_t initial_size)
> mem_pool_alloc_block(pool, initial_size, NULL);
>
> *mem_pool = pool;
> + trace_printf_key(&trace_mem_pool, "mem_pool (%p): init (%"PRIuMAX") initial size\n",
> + pool, (uintmax_t)initial_size);
> }
>
> void mem_pool_discard(struct mem_pool *mem_pool, int invalidate_memory)
> {
> struct mp_block *block, *block_to_free;
>
> + trace_printf_key(&trace_mem_pool, "mem_pool (%p): discard (%"PRIuMAX") unused\n",
> + mem_pool, (uintmax_t)(mem_pool->mp_block->end - mem_pool->mp_block->next_free));
> block = mem_pool->mp_block;
> while (block)
> {
>
> base-commit: bb75be6cb916297f271c846f2f9caa3daaaec718
> --
> 2.18.0.windows.1
>
>
next prev parent reply other threads:[~2018-11-28 9:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 19:53 [PATCH v1] mem_pool: add GIT_TRACE_MEMPOOL support Ben Peart
2018-11-28 9:37 ` Johannes Schindelin [this message]
2018-11-29 14:09 ` Ben Peart
2018-11-29 15:37 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.QRO.7.76.6.1811281036300.41@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=benpeart@microsoft.com \
--cc=git@vger.kernel.org \
--cc=peartben@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).