Files
sysprof/src/libsysprof/sysprof-memprof-profile.h
Christian Hergert 33c81a3a9c memprof: add memory profiling using LD_PRELOAD
This brings over some of the techniques from the old memprof design.
Sysprof and memprof shared a lot of code, so it is pretty natural to
bring back the same callgraph view based on memory allocations.

This reuses the StackStash just like it did in memprof. While it
would be nice to reuse some existing tools out there, the fit of
memprof with sysprof is so naturally aligned, it's not really a
big deal to bring back the LD_PRELOAD. The value really comes
from seeing all this stuff together instead of multiple apps.

There are plenty of things we can implement on top of this that
we are not doing yet such as temporary allocations, cross-thread
frees, graphing the heap, and graphing differences between the
heap at to points in time. I'd like all of these things, given
enough time to make them useful.

This is still a bit slow though due to the global lock we take
to access the writer. To improve the speed here we need to get
rid of that lock and head towards a design that allows a thread
to request a new writer from Sysprof and save it in TLS (to be
destroyed when the thread exits).
2020-02-07 19:00:33 -08:00

54 lines
2.0 KiB
C

/* sysprof-memprof-profile.h
*
* Copyright 2020 Christian Hergert <chergert@redhat.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#if !defined (SYSPROF_INSIDE) && !defined (SYSPROF_COMPILATION)
# error "Only <sysprof.h> can be included directly."
#endif
#include "sysprof-version-macros.h"
#include "sysprof-profile.h"
#include "sysprof-selection.h"
G_BEGIN_DECLS
#define SYSPROF_TYPE_MEMPROF_PROFILE (sysprof_memprof_profile_get_type())
SYSPROF_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (SysprofMemprofProfile, sysprof_memprof_profile, SYSPROF, MEMPROF_PROFILE, GObject)
SYSPROF_AVAILABLE_IN_3_36
SysprofProfile *sysprof_memprof_profile_new (void);
SYSPROF_AVAILABLE_IN_3_36
SysprofProfile *sysprof_memprof_profile_new_with_selection (SysprofSelection *selection);
SYSPROF_AVAILABLE_IN_3_36
gpointer sysprof_memprof_profile_get_native (SysprofMemprofProfile *self);
SYSPROF_AVAILABLE_IN_3_36
gpointer sysprof_memprof_profile_get_stash (SysprofMemprofProfile *self);
SYSPROF_AVAILABLE_IN_3_36
gboolean sysprof_memprof_profile_is_empty (SysprofMemprofProfile *self);
SYSPROF_AVAILABLE_IN_3_36
GQuark sysprof_memprof_profile_get_tag (SysprofMemprofProfile *self,
const gchar *symbol);
G_END_DECLS