Commit Graph

239 Commits

Author SHA1 Message Date
0e9f4ca291 visualizers: limit mark rows to 30 2018-05-16 12:44:48 +01:00
14d2554c35 marks: add group to visualizer row
This will allow us to filter events that we do not care about for a given
row. We add a visualizer row per-group.
2018-05-16 12:44:48 +01:00
4f9ea0fce8 visualizers: discover group types when locating mark types 2018-05-16 12:44:48 +01:00
540ff0e05d marks: stub out a visualizer row
This doesn't do any rendering yet, but it gets us the plumbing we need to
start rendering mark content into a visualizer row.
2018-05-16 12:44:48 +01:00
6fa2c270e8 visualizers: discover visualizers from capture reader
The goal here is to avoid having to hard code what visualizers are shown
from the .ui files. We just should add things that we find are supported.

Long term, I think we'll add a concept of an "instrument" which is the
combination of a data source (SpSource) and a visualizer (SpVisualizerRow).

The other goal here is to enable the future support for discovering marks
and adding rows for each of those threads.
2018-05-16 12:44:48 +01:00
6da2a3be4b clock: handle uninitialized clock gracefully
If we haven't discovered the proper clock, just default to monotonic.
2018-05-16 12:30:10 +01:00
f8176b699b clock: prefer clock monotonic
Various articles claim that CLOCK_MONOTONIC is actually faster than the
CLOCK_MONOTONIC_RAW, and that seems to be my experience.
2018-05-16 12:28:42 +01:00
ac11f0f941 sources/perf: Capture DRM vblank events as a mark.
This should be useful to visualize system-wide events in the CPU
timeline, especially once we add some more events.

We may want to define some modes eventually, as not all captures will
care about GPU visualization.  However, it's pretty low overhead (60Hz
* number of monitors), so maybe we can just filter it out at
visualization time.

We do a bit more setup work than necessary here (looking up the config
number for the tracepoint per CPU, rather than looking it up once at
startup), but I suspect I'll want to refactor the init anyway once we
add more tracepoint markers.
2018-05-16 10:52:28 +01:00
925dadce82 sources/perf: Include the sample identifier in PERF_RECORD_SAMPLE.
If we want to start watching other perf events, we need a way to look
up what perf event we got when a PERF_RECORD_SAMPLE comes in.  The
sample identifier is what does that.
2018-05-16 10:52:28 +01:00
83b75e6528 sources/perf: Add an explanatory comment for the CPU loop.
I stumbled over this kernel restriction, too.
2018-05-16 10:52:28 +01:00
380995fde5 sources/perf: Add a comment explaining sp-perf-counter structs. 2018-05-16 10:52:28 +01:00
e853c79be9 mark: add group to mark event
This allows grouping marks together so that the UI can present marks within
the same group in the same visualizer row.

The goal here is that our perf stream with drm data will have "drm" or some
similar group name (resulting in one row). mutter/cogl/gnome-shell will
use the thread-id as the group name (or something else that is useful) so
their events are grouped together. gdk-wayland might have it's own group
name as well.

The end result is that we can get a mark row for each series of related
data.
2018-05-15 16:33:30 +01:00
eb6fdffa6f visualizers: fix whitespace 2018-05-15 11:35:01 +01:00
6e8c30dfa3 line-visualizer: use array for pointers and mark private 2018-05-15 10:02:58 +01:00
c6260ad177 capture: update stats for marks 2018-05-14 17:51:51 +01:00
4bdbf130b2 capture: add simple mark support
The goal here is to have an API that allows us to record things like
frame timing data. We might iterate on this API a bit, but this gets us
started.

A SpCaptureMark with a zero duration should be treated like an epoch mark
once a visualizer is created. SpCaptureMark with a non-zero duration should
be treated like a begin/end of operation. This may be useful in generating
something like a flame graph.
2018-05-14 17:15:57 +01:00
c3d1fd0ff8 sp-capture-writer: Initialize write buffer
Valgrind notes that the buffer is not fully initialized when we pass it
to write(). This could potentially write sensitive data, if we are not
careful with the buffer length.

See https://gitlab.gnome.org/GNOME/gjs/issues/120

https://bugzilla.gnome.org/show_bug.cgi?id=794272
2018-03-12 16:50:51 -07:00
0219ee5205 capture-cursor: specify const for condition
We don't modify this, so it can be const.
2018-02-13 17:18:28 -08:00
951213ddb6 capture-reader: cleanup some space checks
Add a few more assertions to make sure we have what we think we have. Also
we can drop self->pos from our while loop checks as it will always be zero.
2018-02-13 17:10:02 -08:00
0ec2c127ea capture-reader: fix byte swap of frame info
If we are swapping between endianness, we were miss swapping various fields
and they'd all end up with the swapped len value.
2018-02-13 16:34:41 -08:00
0ddab3db6e callgraph: add information about expectations 2018-01-29 02:11:03 -08:00
3b3252e050 kernel-symbol: delay symbol filtering until lookup
We don't want to avoid adding the symbols to the index table, or we will
get the wrong addresses.

So instead, add them, and then ignore the symbols upon lookup.
2018-01-29 02:09:31 -08:00
8a47f72749 callgraph: use last valid context 2018-01-29 01:38:35 -08:00
c05d5a5d66 callgraph: code style cleanup 2018-01-29 01:38:35 -08:00
2f6b01781f elf: ignore address context that is not user
We should be betting a context change as part of the stack, so ignore it
if we didn't get a user context.
2018-01-29 01:38:35 -08:00
deecb04963 kernel-symbol: code style cleanup 2018-01-29 01:38:35 -08:00
1bc52902eb kernel-symbols: avoid symbols not in text (code) section
Those are defind as t or T type.
2018-01-29 01:38:35 -08:00
8fb46f3e7f kernel-symbol: fix result parsing from sysprofd
We need to add an additional () around our result type from sysprofd.
2018-01-29 01:38:35 -08:00
911d51d447 kallsyms: make SpKallsyms more testable
This allows us to pass in the file to read from, and adds a quick test
case to view the parsed output. It also fixes a base-10 vs base-16
mistake in parsing addresses.
2018-01-29 01:38:35 -08:00
acab78da72 callgraph: use sp_symbol_resolver_resolve_with_context()
We want to ensure that we give the resolve the address context so that it
can filter whether or not the address range applies.
2018-01-28 22:16:59 -08:00
bb78a1c165 elf: only resolve addresses in none/user address context
This ensures that we only try to resolve addresses for ELFs when we know
we're inside of the userspace address context.
2018-01-28 22:14:32 -08:00
aa0506e26f symbol-resolver: check for kernel address context
We only want to resolve a symbol if we're inside the kernel context.
Otherwise, it wont be accurate.
2018-01-28 22:13:49 -08:00
df07f6d915 resolver: extend interface to include address context
We might need access to the address context when resolving symbols so that
we know if the address range applies to us.
2018-01-28 22:12:27 -08:00
128aa18a00 lib: query /proc/kallsyms and/or daemon for symbols
If we have a system where we can read kallsyms without elevated
privilledges do that. Otherwise, query the sysprod daemon to get the
available kernel symbols.
2018-01-28 21:34:44 -08:00
cf756c65aa kernel-symbol-resolver: code style cleanup 2018-01-28 21:26:47 -08:00
26343e3d2a kallsyms: add API to extract kallsyms with strtok_r()
This will allow us to simplify some code, and provide an API in both
the lib and daemon to get symbols while sharing code.
2018-01-28 21:26:17 -08:00
0e8b51c6ab kernel: only try to load kernel symbol map once
If we fail, log a message to the console and bail. This seems to happen
with recent kernel changes.
2018-01-27 01:10:00 -08:00
469d54df5b build: add libsysprof-capture-2 static library
This allows external tooling to write capture files that Sysprof can open.
Ideally, this will get used by GJS in the near future to implement profiler
output for Sysprof.
2018-01-20 01:30:39 -08:00
6fa95dfb6f lgpl: relicense some useful files as LGPLv2.1+ 2018-01-20 01:26:17 -08:00
1e0f505d7c model-filter: simplify model filter implementation
We've had a number of errors reported from our previous
model filter implementation. This simplifies the impliementation
using a simple cross-reference structure with GSequenceIter in
both sequences.

We try extra hard to not emit signals when doing invalidation.
2017-11-24 22:02:06 -08:00
a2c1e92b79 process-model-row: escape for markup
We need to ensure this gets escaped since we cannot really trust
what comes from /proc.
2017-11-24 22:00:53 -08:00
bcb43d39bb profiler-menu-button: simplify filtering code
Instead of fetching the text from the filter func, we can just
reset the filter func with custom data.
2017-11-24 22:00:20 -08:00
b142d79bdc util: clear field when destroying
Just to be a bit more defensive.
2017-11-24 00:35:42 -08:00
b78293657d util: add synchronous form to reload model 2017-11-24 00:35:14 -08:00
00b6892a72 build: fix header installation paths 2017-09-28 17:45:07 -07:00
190faa818d build: use subdir meson.build files
This keeps the build file closer to the sources it effects.
2017-09-28 16:57:00 -07:00
c47822b26e source tree cleanup
The lib/ directory was getting a bit out of hand, so this tries
to organize things a bit so it is easier going forward to locate
the code people want to patch.
2017-09-28 16:23:03 -07:00
a71f05b885 line-visualizer: lower task priority
Keep task priorities lower than the Gtk main loop.
2017-09-28 13:25:22 -07:00
cad87dee49 line-visualizer: teach draw code how to fill in lines
We don't expose this via API yet, but it's handy to have it here so we can
build upon it for doing stacked drawings (as useful for things like memory
usage graphs by type).
2017-09-28 13:24:58 -07:00
3e5a2af1b4 build: remove autotools build system
Now that we are post-3.26, we are removing the legacy autotools
build system in favor of meson.

Please report any errors you have so that we can ensure this is
ready for GNOME 3.28.
2017-09-15 17:44:50 -07:00