This requires that things use #include <sysprof.h> now instead
of individual includes. A few cases are still allowed in the
libsysprof-capture library to make copy/paste embedding easier.
As we gain in usage, we need to be more careful about using a prefix
that will not collide with other symbols. So version 3 of our ABI will
change to using Sysprof/SYSPROF/sysprof as the various prefixes.
The soname/api version bump will happen later on this branch so that
things are easier to test up until then.
We can just include the files directly, and avoid the static
linking and potential problems that come with that when porting
the build system to other platforms.
This also moves stackstash.[ch] into a location that can be
embedded by both the libsysprof and libsysprof-ui code. We
pass native pointers to the structure as a gpointer in the
public API to allow for this. The performance of that code is
incredibly sensitive to the interactivity of Sysprof.
This moves everything into other places and simple includes the
files in the cases that it is necessary. In the future, we can
rewrite sysprofd to use GDBus and add GetProcFile() to allow
for client-side processing of kallsyms.
This doesn't make profiling useful in any way, but it does get things
to the point where I can actually open a capture file. And it would
be nice if we could progress to the point of loading capture files
(with correct data in-tact) and this helps us move down that path.
To really do that correctly, we should make some of the widgetry
disabled when it isn't useful. We also need to ensure that we add extra
decoding information to capture files during shutdown so that any
platform can read it back. This would also help the situation of
running and reading on separate architectures.
Of course, this all needs improvements to be realistically useful, but
it allows us to get things at least opening. We can adjust how we
store that data to make it available on other OS's later.
The big thing going on here is that we are going to split up the libraries
a bit better, and remove GObject from the capture library. The libsysprof
library will bring in the capture library statically, so we can export the
symbols we want.
Eventually, we will bump the version to sysprof-3, but not yet.
This switches over to using the portability helpers that may
be needed on some platforms other than Linux. On Linux, however,
they are just macros to the standard implementation provided
by (g)libc.
If we're on non-Linux, we can use some portability fallbacks to
get similar behavior to Linux. I'm sure we can optimize this a
bit more for FreeBSD if someone with that installed wants to
come look at things and improve them.
There were some GCC'isms here that don't port well to mingw
(and likely other win32 compilers). Of note are the removal
of #pragma pack to instead use the GCC attributes or MSVC
declarations. Also we cannot be so liberal in our use of
bitflags, we need to use common types from neighbors.
We still generally only build on Linux from the Sysprof
project, but we can start to support other systems in the
capture format (with the possibility of being more general
for the UI later on too).
We want the capture format to be usable on systems other than
Linux so that it can be used in places like GTK. To do this,
we need a sendfile() fallback that can be portable/useful on
those systems.
FreeBSD has sendfile(), but the semantics differ slightly. This
implementation will walk up to the nearest page size and then
do page aligned pread()/write() which is likely good enough of
an implementation anyway.