mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
gjs: add gjs source back
This sets various environment variables we need.
This commit is contained in:
@ -25,9 +25,7 @@
|
||||
<property name="display-name">GJS</property>
|
||||
<property name="icon-name">org.gnome.Sysprof-symbolic</property>
|
||||
<child>
|
||||
<object class="SysprofTracefdSource">
|
||||
<property name="envvar">GJS_TRACE_FD</property>
|
||||
</object>
|
||||
<object class="SysprofGjsSource"/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="SysprofAid" id="app_aid">
|
||||
|
||||
@ -7,6 +7,7 @@ libsysprof_public_sources = [
|
||||
'sysprof-capture-gobject.c',
|
||||
'sysprof-capture-symbol-resolver.c',
|
||||
'sysprof-elf-symbol-resolver.c',
|
||||
'sysprof-gjs-source.c',
|
||||
'sysprof-hostinfo-source.c',
|
||||
'sysprof-jitmap-symbol-resolver.c',
|
||||
'sysprof-kernel-symbol.c',
|
||||
@ -30,6 +31,7 @@ libsysprof_public_headers = [
|
||||
'sysprof-capture-gobject.h',
|
||||
'sysprof-capture-symbol-resolver.h',
|
||||
'sysprof-elf-symbol-resolver.h',
|
||||
'sysprof-gjs-source.h',
|
||||
'sysprof-hostinfo-source.h',
|
||||
'sysprof-jitmap-symbol-resolver.h',
|
||||
'sysprof-kernel-symbol.h',
|
||||
|
||||
69
src/libsysprof/sysprof-gjs-source.c
Normal file
69
src/libsysprof/sysprof-gjs-source.c
Normal file
@ -0,0 +1,69 @@
|
||||
/* sysprof-gjs-source.c
|
||||
*
|
||||
* Copyright 2019 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
|
||||
*/
|
||||
|
||||
#define G_LOG_DOMAIN "sysprof-gjs-source"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "sysprof-gjs-source.h"
|
||||
|
||||
struct _SysprofGjsSource
|
||||
{
|
||||
SysprofTracefdSource parent_instance;
|
||||
};
|
||||
|
||||
static SysprofSourceInterface *parent_iface;
|
||||
|
||||
static void
|
||||
sysprof_gjs_source_modify_spawn (SysprofSource *source,
|
||||
GSubprocessLauncher *launcher,
|
||||
GPtrArray *argv)
|
||||
{
|
||||
g_subprocess_launcher_setenv (launcher, "GJS_ENABLE_PROFILER", "1", FALSE);
|
||||
parent_iface->modify_spawn (source, launcher, argv);
|
||||
}
|
||||
|
||||
static void
|
||||
source_iface_init (SysprofSourceInterface *iface)
|
||||
{
|
||||
parent_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->modify_spawn = sysprof_gjs_source_modify_spawn;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (SysprofGjsSource, sysprof_gjs_source, SYSPROF_TYPE_TRACEFD_SOURCE,
|
||||
G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SOURCE, source_iface_init))
|
||||
|
||||
static void
|
||||
sysprof_gjs_source_class_init (SysprofGjsSourceClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_gjs_source_init (SysprofGjsSource *self)
|
||||
{
|
||||
sysprof_tracefd_source_set_envvar (SYSPROF_TRACEFD_SOURCE (self), "GJS_TRACE_FD");
|
||||
}
|
||||
|
||||
SysprofSource *
|
||||
sysprof_gjs_source_new (void)
|
||||
{
|
||||
return g_object_new (SYSPROF_TYPE_GJS_SOURCE, NULL);
|
||||
}
|
||||
35
src/libsysprof/sysprof-gjs-source.h
Normal file
35
src/libsysprof/sysprof-gjs-source.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* sysprof-gjs-source.h
|
||||
*
|
||||
* Copyright 2019 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-tracefd-source.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_TYPE_GJS_SOURCE (sysprof_gjs_source_get_type())
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
G_DECLARE_FINAL_TYPE (SysprofGjsSource, sysprof_gjs_source, SYSPROF, GJS_SOURCE, SysprofTracefdSource)
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
SysprofSource *sysprof_gjs_source_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
@ -28,6 +28,7 @@ G_BEGIN_DECLS
|
||||
# include "sysprof-capture-gobject.h"
|
||||
# include "sysprof-capture-symbol-resolver.h"
|
||||
# include "sysprof-elf-symbol-resolver.h"
|
||||
# include "sysprof-gjs-source.h"
|
||||
# include "sysprof-jitmap-symbol-resolver.h"
|
||||
# include "sysprof-kernel-symbol-resolver.h"
|
||||
# include "sysprof-kernel-symbol.h"
|
||||
|
||||
@ -221,8 +221,7 @@ main (gint argc,
|
||||
|
||||
if (gjs)
|
||||
{
|
||||
source = sysprof_tracefd_source_new ();
|
||||
sysprof_tracefd_source_set_envvar (SYSPROF_TRACEFD_SOURCE (source), "GJS_TRACE_FD");
|
||||
source = sysprof_gjs_source_new ();
|
||||
sysprof_profiler_add_source (profiler, source);
|
||||
g_object_unref (source);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user