libsysprof-analyze: add interface for stracetrace types

Currently, this would need to be implemented by SysprofDocumentSample and
SysprofDocumentAllocation. But we could potentially start allowing many
types to attach a trace if we modifier the capture format to allow it.
This commit is contained in:
Christian Hergert
2023-04-28 12:14:17 -07:00
parent fdfe130edd
commit fe4b6ee812
4 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,44 @@
/*
* sysprof-document-traceable.c
*
* Copyright 2023 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
*/
#include "config.h"
#include "sysprof-document-traceable.h"
G_DEFINE_INTERFACE (SysprofDocumentTraceable, sysprof_document_traceable, SYSPROF_TYPE_DOCUMENT_FRAME)
static void
sysprof_document_traceable_default_init (SysprofDocumentTraceableInterface *iface)
{
}
guint
sysprof_document_traceable_get_stack_depth (SysprofDocumentTraceable *self)
{
return SYSPROF_DOCUMENT_TRACEABLE_GET_IFACE (self)->get_stack_depth (self);
}
guint64
sysprof_document_traceable_get_stack_address (SysprofDocumentTraceable *self,
guint position)
{
return SYSPROF_DOCUMENT_TRACEABLE_GET_IFACE (self)->get_stack_address (self, position);
}