mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-profile: add scaffolding for controlfd source
This is internal to the profile and will always be active when running subprocesses with Sysprof.
This commit is contained in:
@ -5,6 +5,7 @@ libsysprof_profile_public_sources = [
|
||||
]
|
||||
|
||||
libsysprof_profile_private_sources = [
|
||||
'sysprof-controlfd-instrument.c',
|
||||
]
|
||||
|
||||
libsysprof_profile_public_headers = [
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
/* sysprof-controlfd-instrument-private.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-instrument-private.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_TYPE_CONTROLFD_INSTRUMENT (sysprof_controlfd_instrument_get_type())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SysprofControlfdInstrument, sysprof_controlfd_instrument, SYSPROF, CONTROLFD_INSTRUMENT, SysprofInstrument)
|
||||
|
||||
SysprofInstrument *_sysprof_controlfd_instrument_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
57
src/libsysprof-profile/sysprof-controlfd-instrument.c
Normal file
57
src/libsysprof-profile/sysprof-controlfd-instrument.c
Normal file
@ -0,0 +1,57 @@
|
||||
/* sysprof-controlfd-instrument.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-controlfd-instrument-private.h"
|
||||
|
||||
struct _SysprofControlfdInstrument
|
||||
{
|
||||
SysprofInstrument parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_FINAL_TYPE (SysprofControlfdInstrument, sysprof_controlfd_instrument, SYSPROF_TYPE_INSTRUMENT)
|
||||
|
||||
static void
|
||||
sysprof_controlfd_instrument_finalize (GObject *object)
|
||||
{
|
||||
SysprofControlfdInstrument *self = (SysprofControlfdInstrument *)object;
|
||||
|
||||
G_OBJECT_CLASS (sysprof_controlfd_instrument_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_controlfd_instrument_class_init (SysprofControlfdInstrumentClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = sysprof_controlfd_instrument_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_controlfd_instrument_init (SysprofControlfdInstrument *self)
|
||||
{
|
||||
}
|
||||
|
||||
SysprofInstrument *
|
||||
_sysprof_controlfd_instrument_new (void)
|
||||
{
|
||||
return g_object_new (SYSPROF_TYPE_CONTROLFD_INSTRUMENT, NULL);
|
||||
}
|
||||
@ -20,6 +20,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "sysprof-controlfd-instrument-private.h"
|
||||
#include "sysprof-profiler.h"
|
||||
#include "sysprof-recording-private.h"
|
||||
|
||||
@ -82,6 +83,8 @@ static void
|
||||
sysprof_profiler_init (SysprofProfiler *self)
|
||||
{
|
||||
self->instruments = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
|
||||
sysprof_profiler_add_instrument (self, _sysprof_controlfd_instrument_new ());
|
||||
}
|
||||
|
||||
SysprofProfiler *
|
||||
|
||||
Reference in New Issue
Block a user