libsysprof-analyze: start on sysprof-analyze library

The goal here is to break up libsysprof into a library for recording
profiles (using libsysprof-capture) and a library for analyzing profiles
(both used by the sysprof UI).
This commit is contained in:
Christian Hergert
2023-04-25 11:57:26 -07:00
parent e888d0602e
commit efab045006
13 changed files with 111 additions and 13 deletions

View File

@ -0,0 +1,45 @@
libsysprof_analyze_public_sources = [
'sysprof-capture-model.c',
'sysprof-capture-frame-object.c',
]
libsysprof_analyze_public_headers = [
'sysprof-analyze.h',
'sysprof-capture-model.h',
'sysprof-capture-frame-object.h',
]
libsysprof_analyze_deps = [
dependency('gio-2.0', version: glib_req_version),
libsysprof_capture_deps,
]
libsysprof_analyze = library('sysprof-analyze',
libsysprof_analyze_public_sources,
include_directories: [include_directories('.'),
ipc_include_dirs,
libsysprof_capture_include_dirs],
dependencies: libsysprof_analyze_deps,
gnu_symbol_visibility: 'hidden',
version: '@0@.0.0'.format(soname_major_version),
darwin_versions: '@0@.0'.format(soname_major_version),
)
libsysprof_analyze_dep = declare_dependency(
link_with: libsysprof_analyze,
dependencies: libsysprof_analyze_deps,
include_directories: [include_directories('.'), libsysprof_capture_include_dirs],
)
meson.override_dependency('sysprof-analyze-@0@'.format(soname_major_version), libsysprof_analyze_dep)
pkgconfig.generate(libsysprof_analyze,
subdirs: [sysprof_header_subdir],
description: 'A library for processing and analyzing Sysprof captures',
install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
requires: ['gio-2.0'],
variables: ['datadir=' + datadir_for_pc_file],
)
install_headers(libsysprof_analyze_public_headers, subdir: sysprof_header_subdir)
subdir('tests')

View File

@ -0,0 +1,32 @@
/* sysprof-analyze.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 <glib.h>
G_BEGIN_DECLS
#define SYSPROF_ANALYZE_INSIDE
# include "sysprof-capture-frame-object.h"
# include "sysprof-capture-model.h"
#undef SYSPROF_ANALYZE_INSIDE
G_END_DECLS

View File

@ -0,0 +1,31 @@
libsysprof_analyze_test_env = [
'G_DEBUG=gc-friendly',
'GSETTINGS_BACKEND=memory',
'MALLOC_CHECK_=2',
]
libsysprof_analyze_testsuite_c_args = [
'-DG_LOG_DOMAIN="libdex"',
'-DG_ENABLE_DEBUG',
'-UG_DISABLE_ASSERT',
'-UG_DISABLE_CAST_CHECKS',
]
libsysprof_analyze_testsuite = {
'test-capture-model': {'skip': true},
}
libsysprof_analyze_testsuite_deps = [
libsysprof_analyze_dep,
libsysprof_capture_dep,
]
foreach test, params: libsysprof_analyze_testsuite
test_exe = executable(test, '@0@.c'.format(test),
c_args: libsysprof_analyze_testsuite_c_args,
dependencies: libsysprof_analyze_testsuite_deps,
)
if not params.get('skip', false)
test(test, test_exe, env: libsysprof_analyze_test_env)
endif
endforeach

View File

@ -1,7 +1,6 @@
#include <errno.h>
#include <fcntl.h>
#include <sysprof.h>
#include <sysprof-analyze.h>
int
main (int argc,

View File

@ -3,9 +3,7 @@ libsysprof_c_args = [ '-DSYSPROF_COMPILATION' ]
libsysprof_public_sources = [
'sysprof-battery-source.c',
'sysprof-callgraph-profile.c',
'sysprof-capture-frame-object.c',
'sysprof-capture-gobject.c',
'sysprof-capture-model.c',
'sysprof-capture-symbol-resolver.c',
'sysprof-control-source.c',
'sysprof-diskstat-source.c',
@ -38,9 +36,7 @@ libsysprof_public_headers = [
'sysprof-battery-source.h',
'sysprof-callgraph-profile.h',
'sysprof-capture-autocleanups.h',
'sysprof-capture-frame-object.h',
'sysprof-capture-gobject.h',
'sysprof-capture-model.h',
'sysprof-capture-symbol-resolver.h',
'sysprof-control-source.h',
'sysprof-diskstat-source.h',

View File

@ -28,9 +28,7 @@ G_BEGIN_DECLS
# include "sysprof-battery-source.h"
# include "sysprof-callgraph-profile.h"
# include "sysprof-capture-autocleanups.h"
# include "sysprof-capture-frame-object.h"
# include "sysprof-capture-gobject.h"
# include "sysprof-capture-model.h"
# include "sysprof-capture-symbol-resolver.h"
# include "sysprof-control-source.h"
# include "sysprof-diskstat-source.h"

View File

@ -55,6 +55,8 @@ stackstash_sources = files('stackstash.c')
helpers_sources = files('helpers.c')
subdir('libsysprof-capture')
subdir('libsysprof-analyze')
if get_option('sysprofd') == 'bundled'
subdir('sysprofd')
endif

View File

@ -56,11 +56,6 @@ if get_option('libsysprof')
dependencies: test_deps,
)
test_capture_model = executable('test-capture-model', 'test-capture-model.c',
c_args: test_cflags,
dependencies: test_deps,
)
test_mountinfo = executable('test-mountinfo', 'test-mountinfo.c',
c_args: test_cflags,
dependencies: test_deps,