libsysprof-analyze: add document type for task exit

We don't have any extra data here currently, but it can be nice to be able
to check a gtype when consuming frames.
This commit is contained in:
Christian Hergert
2023-04-27 17:50:28 -07:00
parent 89f9bba8e2
commit d878fbf372
5 changed files with 92 additions and 0 deletions

View File

@ -1,5 +1,6 @@
libsysprof_analyze_public_sources = [
'sysprof-document.c',
'sysprof-document-exit.c',
'sysprof-document-frame.c',
'sysprof-document-log.c',
'sysprof-document-mark.c',
@ -11,6 +12,7 @@ libsysprof_analyze_public_sources = [
libsysprof_analyze_public_headers = [
'sysprof-analyze.h',
'sysprof-document.h',
'sysprof-document-exit.h',
'sysprof-document-frame.h',
'sysprof-document-log.h',
'sysprof-document-mark.h',

View File

@ -26,6 +26,7 @@ G_BEGIN_DECLS
#define SYSPROF_ANALYZE_INSIDE
# include "sysprof-document.h"
# include "sysprof-document-exit.h"
# include "sysprof-document-frame.h"
# include "sysprof-document-log.h"
# include "sysprof-document-mark.h"

View File

@ -0,0 +1,46 @@
/* sysprof-document-exit.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-frame-private.h"
#include "sysprof-document-exit.h"
struct _SysprofDocumentExit
{
SysprofDocumentFrame parent_instance;
};
struct _SysprofDocumentExitClass
{
SysprofDocumentFrameClass parent_class;
};
G_DEFINE_FINAL_TYPE (SysprofDocumentExit, sysprof_document_exit, SYSPROF_TYPE_DOCUMENT_FRAME)
static void
sysprof_document_exit_class_init (SysprofDocumentExitClass *klass)
{
}
static void
sysprof_document_exit_init (SysprofDocumentExit *self)
{
}

View File

@ -0,0 +1,39 @@
/* sysprof-document-exit.h
*
* 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
*/
#pragma once
#include "sysprof-document-frame.h"
G_BEGIN_DECLS
#define SYSPROF_TYPE_DOCUMENT_EXIT (sysprof_document_exit_get_type())
#define SYSPROF_IS_DOCUMENT_EXIT(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, SYSPROF_TYPE_DOCUMENT_EXIT)
#define SYSPROF_DOCUMENT_EXIT(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, SYSPROF_TYPE_DOCUMENT_EXIT, SysprofDocumentExit)
#define SYSPROF_DOCUMENT_EXIT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, SYSPROF_TYPE_DOCUMENT_EXIT, SysprofDocumentExitClass)
typedef struct _SysprofDocumentExit SysprofDocumentExit;
typedef struct _SysprofDocumentExitClass SysprofDocumentExitClass;
SYSPROF_AVAILABLE_IN_ALL
GType sysprof_document_exit_get_type (void) G_GNUC_CONST;
G_END_DECLS

View File

@ -21,6 +21,8 @@
#include "config.h"
#include "sysprof-document-frame-private.h"
#include "sysprof-document-exit.h"
#include "sysprof-document-log.h"
#include "sysprof-document-mark.h"
#include "sysprof-document-mmap.h"
@ -136,6 +138,8 @@ _sysprof_document_frame_new (GMappedFile *mapped_file,
gtype = SYSPROF_TYPE_DOCUMENT_MARK;
else if (frame->type == SYSPROF_CAPTURE_FRAME_PROCESS)
gtype = SYSPROF_TYPE_DOCUMENT_PROCESS;
else if (frame->type == SYSPROF_CAPTURE_FRAME_EXIT)
gtype = SYSPROF_TYPE_DOCUMENT_EXIT;
self = g_object_new (gtype, NULL);
self->mapped_file = g_mapped_file_ref (mapped_file);