OpenBSD CVS

CVS log for src/usr.sbin/btrace/ksyms.c


[BACK] Up to [local] / src / usr.sbin / btrace

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.10 / (download) - annotate - [select for diffs], Mon Apr 1 22:49:04 2024 UTC (2 months ago) by jsg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

init var to fix missing symtab section path
found by smatch, ok mpi@

Revision 1.9 / (download) - annotate - [select for diffs], Sat Mar 16 17:42:37 2024 UTC (2 months, 3 weeks ago) by cheloha
Branch: MAIN
Changes since 1.8: +136 -106 lines
Diff to previous 1.8 (colored)

btrace(8): cache ELF symbols in sorted array

Currently, every kelf_snprintsym() call performs a linear search
through the .symtab for a symbol matching the given PC.  The search is
expensive and seems to be a major source of dropped profiling events.

Storing all STT_FUNC .symtab entries and their names in a sorted array
cuts search time from O(n) to O(lg n).  In practice, the faster
lookups seem to dramatically reduce the profiling drop rate.

With tweaks from mpi@.

Thread: https://marc.info/?l=openbsd-tech&m=170830125132105&w=2

ok mpi@

Revision 1.8 / (download) - annotate - [select for diffs], Thu Mar 14 00:54:54 2024 UTC (2 months, 3 weeks ago) by cheloha
Branch: MAIN
Changes since 1.7: +105 -135 lines
Diff to previous 1.7 (colored)

Revert "btrace(8): cache ELF .symtab, .strtab entries in sorted array"

"No it's not okay." mpi@

Revision 1.7 / (download) - annotate - [select for diffs], Tue Mar 12 17:22:24 2024 UTC (2 months, 3 weeks ago) by cheloha
Branch: MAIN
Changes since 1.6: +136 -106 lines
Diff to previous 1.6 (colored)

btrace(8): cache ELF .symtab, .strtab entries in sorted array

Currently, every kelf_snprintsym() call performs a linear search
through the .symtab for a matching symbol.  The search is very
costly and causes btrace(8) to drop a lot of profiling events.

Storing the STT_FUNC .symtab entries and their corresponding .strtab
entries in a sorted array cuts the lookup cost from O(n) to O(lg n).
Lower overhead reduces the drop rate for profiling events.

With tweaks from mpi@.

Thread: https://marc.info/?l=openbsd-tech&m=170830125132105&w=2

probably ok mpi@

Revision 1.6 / (download) - annotate - [select for diffs], Fri Nov 10 18:56:21 2023 UTC (6 months, 4 weeks ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.5: +1 -3 lines
Diff to previous 1.5 (colored)

zap some unused includes

Revision 1.5 / (download) - annotate - [select for diffs], Fri May 12 14:14:16 2023 UTC (12 months, 3 weeks ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.4: +59 -46 lines
Diff to previous 1.4 (colored)

btrace(8) support to symbolize utrace addresses.

This only works for a single static binary where everything was compiled
with -fno-omit-frame-pointer since the stack unwinder requires the
frame-pointer.

A possible btrace script to capture performace of a single process is:
profile:hz:100 / pid == $1 / {
        @[ustack] = count();
}
Then using btrace -p program uprofile.bt `pgrep program` will collect
the information for program.

This is far from perfect but should allow other people to play with this
and hopefully improve work.
OK mpi@

Revision 1.4 / (download) - annotate - [select for diffs], Wed Feb 10 00:34:57 2021 UTC (3 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

cast large to reduce warning on 32-bit machines (an ELF type is printed with %ll)

Revision 1.3 / (download) - annotate - [select for diffs], Mon Dec 7 18:28:09 2020 UTC (3 years, 6 months ago) by bluhm
Branch: MAIN
Changes since 1.2: +12 -3 lines
Diff to previous 1.2 (colored)

In btrace(8) handle snprintf(3) errors correctly.  If snprintf
fails, buffer is unchanged; initialize it with empty string.  snprintf
may return negative value or the length that would have been written;
check and calculate remaining size.  snprintf writes size - 1
characters; pass buffer size as length.
OK mpi@

Revision 1.2 / (download) - annotate - [select for diffs], Thu Aug 13 11:35:21 2020 UTC (3 years, 9 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.1: +5 -7 lines
Diff to previous 1.1 (colored)

Be compatible with bpftrace(8)'s output when printing stack traces in maps.

This allows us to use `stackcollapse-bpftrace.pl' from Brendan Gregg's
FrameGraph without pre-processing outputs.

Revision 1.1 / (download) - annotate - [select for diffs], Tue Jan 21 16:24:55 2020 UTC (4 years, 4 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7

Import a bug tracer, companion of dt(4), that speaks the bt(5) language.

ok kettenis@, visa@, jasper@, deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.