[PATCH v3 6/9] gdb/ctf: add scoped_time_it in elfctf_build_psymtabs

Simon Marchi
2026-02-28T03:55:32Z

This will be useful to determine the impact on the startup time getting
rid of partial symtabs has.

I use it like so:

$ ./gdb -q -nx --data-directory=data-directory -iex "maint set per-command time on" /home/simark/src/linux/vmlinux.unstripped -batch
...
Time for "elfctf_build_psymtabs": wall 0.381, user 0.357, sys 0.015, user+sys 0.372, 97.6 % CPU

Change-Id: I021319212f27eee0bf0f6c230f4e7cdd9c3602c1
---
gdb/ctfread.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index ed4a7383427d..251b1c7f1fce 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -79,6 +79,7 @@
#include "complaints.h"
#include "block.h"
#include "ctfread.h"
+#include "maint.h"
#include "psymtab.h"
#include "cli/cli-cmds.h"

@@ -1576,6 +1577,8 @@ elfctf_build_psymtabs (objfile *objfile)
bfd *abfd = objfile->obfd.get ();
int err;

+ scoped_time_it time_it (__func__);
+
CTF_SCOPED_DEBUG_START_END ("building psymtabs for %s",
bfd_get_filename (abfd));

--
2.53.0