mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: join libsysprof-analyze and libsysprof-profile
This brings together the two libraries back into one now that the whole design is pretty well sorted out. They depend on roughly the same libraries anyway and it's way easier of the single library can both read and write the capture files (along with bringing in libsysprof-capture symbols in a single place).
This commit is contained in:
12
meson.build
12
meson.build
@ -38,13 +38,13 @@ need_gtk = get_option('gtk')
|
||||
need_glib = (need_gtk or
|
||||
get_option('examples') or
|
||||
get_option('sysprofd') != 'none' or
|
||||
get_option('agent') or
|
||||
get_option('tools') or
|
||||
get_option('tests'))
|
||||
need_libsysprof = (need_gtk or
|
||||
get_option('libsysprof') or
|
||||
get_option('examples') or
|
||||
get_option('tools') or
|
||||
get_option('tests'))
|
||||
|
||||
# Determine what libraries to build
|
||||
need_libsysprof_capture = true
|
||||
need_libsysprof_profile = get_option('gtk') or get_option('agent')
|
||||
need_libsysprof_analyze = get_option('gtk') or get_option('agent')
|
||||
|
||||
dex_req = '0.3'
|
||||
glib_req = '2.76.0'
|
||||
|
||||
@ -32,6 +32,9 @@ option('help', type: 'boolean')
|
||||
# Disable use of libunwind
|
||||
option('libunwind', type: 'boolean')
|
||||
|
||||
# Build libsysprof (required by tools, tests, sysprof, etc)
|
||||
option('libsysprof', type: 'boolean')
|
||||
|
||||
# Optionally disable the tools (this is mostly only useful for building only
|
||||
# libsysprof-capture as a subproject)
|
||||
option('tools', type: 'boolean')
|
||||
|
||||
@ -1,122 +0,0 @@
|
||||
libsysprof_profile_public_sources = [
|
||||
'sysprof-battery-charge.c',
|
||||
'sysprof-cpu-usage.c',
|
||||
'sysprof-diagnostic.c',
|
||||
'sysprof-disk-usage.c',
|
||||
'sysprof-energy-usage.c',
|
||||
'sysprof-instrument.c',
|
||||
'sysprof-memory-usage.c',
|
||||
'sysprof-malloc-tracing.c',
|
||||
'sysprof-network-usage.c',
|
||||
'sysprof-power-profile.c',
|
||||
'sysprof-profiler.c',
|
||||
'sysprof-proxied-instrument.c',
|
||||
'sysprof-recording.c',
|
||||
'sysprof-sampler.c',
|
||||
'sysprof-spawnable.c',
|
||||
'sysprof-symbols-bundle.c',
|
||||
'sysprof-system-logs.c',
|
||||
'sysprof-tracer.c',
|
||||
]
|
||||
|
||||
libsysprof_profile_private_sources = [
|
||||
'mapped-ring-buffer-source.c',
|
||||
'sysprof-controlfd-instrument.c',
|
||||
'sysprof-maps-parser.c',
|
||||
'sysprof-perf-event-stream.c',
|
||||
'sysprof-journald-source.c',
|
||||
'sysprof-podman.c',
|
||||
]
|
||||
|
||||
if polkit_dep.found()
|
||||
libsysprof_profile_private_sources += ['sysprof-polkit.c']
|
||||
endif
|
||||
|
||||
libsysprof_profile_public_headers = [
|
||||
'sysprof-profile.h',
|
||||
|
||||
'sysprof-battery-charge.h',
|
||||
'sysprof-cpu-usage.h',
|
||||
'sysprof-diagnostic.h',
|
||||
'sysprof-disk-usage.h',
|
||||
'sysprof-energy-usage.h',
|
||||
'sysprof-instrument.h',
|
||||
'sysprof-memory-usage.h',
|
||||
'sysprof-malloc-tracing.h',
|
||||
'sysprof-network-usage.h',
|
||||
'sysprof-power-profile.h',
|
||||
'sysprof-profiler.h',
|
||||
'sysprof-proxied-instrument.h',
|
||||
'sysprof-recording.h',
|
||||
'sysprof-sampler.h',
|
||||
'sysprof-spawnable.h',
|
||||
'sysprof-symbols-bundle.h',
|
||||
'sysprof-system-logs.h',
|
||||
'sysprof-tracer.h',
|
||||
]
|
||||
|
||||
if host_machine.system() == 'linux'
|
||||
libsysprof_profile_private_sources += [
|
||||
'sysprof-linux-instrument.c',
|
||||
]
|
||||
endif
|
||||
|
||||
libsysprof_profile_deps = [
|
||||
dependency('gio-2.0', version: glib_req_version),
|
||||
dependency('gio-unix-2.0',
|
||||
version: glib_req_version,
|
||||
required: host_machine.system() != 'windows'),
|
||||
dependency('json-glib-1.0'),
|
||||
dependency('libdex-1', version: dex_req_version),
|
||||
libsystemd_dep,
|
||||
polkit_dep,
|
||||
|
||||
liblinereader_static_dep,
|
||||
libsysprof_analyze_dep,
|
||||
]
|
||||
|
||||
libsysprof_profile_static = static_library(
|
||||
'sysprof-profile-@0@'.format(soname_major_version),
|
||||
(libsysprof_profile_public_sources +
|
||||
libsysprof_profile_private_sources +
|
||||
mapped_ring_buffer_sources),
|
||||
|
||||
include_directories: [include_directories('.'),
|
||||
libsysprof_capture_include_dirs],
|
||||
dependencies: libsysprof_profile_deps,
|
||||
gnu_symbol_visibility: 'hidden',
|
||||
)
|
||||
|
||||
libsysprof_profile_static_dep = declare_dependency(
|
||||
link_with: libsysprof_profile_static,
|
||||
dependencies: libsysprof_profile_deps,
|
||||
include_directories: [include_directories('.'),
|
||||
libsysprof_capture_include_dirs],
|
||||
)
|
||||
|
||||
libsysprof_profile = library('sysprof-profile-@0@'.format(soname_major_version),
|
||||
dependencies: [libsysprof_profile_static_dep],
|
||||
gnu_symbol_visibility: 'hidden',
|
||||
version: '@0@.0.0'.format(soname_major_version),
|
||||
darwin_versions: '@0@.0'.format(soname_major_version),
|
||||
install: true,
|
||||
)
|
||||
|
||||
libsysprof_profile_dep = declare_dependency(
|
||||
link_with: libsysprof_profile,
|
||||
dependencies: libsysprof_profile_deps,
|
||||
include_directories: [include_directories('.'), libsysprof_capture_include_dirs],
|
||||
)
|
||||
meson.override_dependency('sysprof-profile-@0@'.format(soname_major_version), libsysprof_profile_dep)
|
||||
|
||||
pkgconfig.generate(libsysprof_profile,
|
||||
subdirs: [sysprof_header_subdir],
|
||||
description: 'A library for recording profiles using various instruments',
|
||||
install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
|
||||
requires: ['gio-2.0'],
|
||||
variables: ['datadir=' + datadir_for_pc_file],
|
||||
)
|
||||
|
||||
install_headers(libsysprof_profile_public_headers, subdir: sysprof_header_subdir)
|
||||
|
||||
subdir('tests')
|
||||
@ -1,48 +0,0 @@
|
||||
/* sysprof-profile.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 <gio/gio.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_PROFILE_INSIDE
|
||||
# include "sysprof-battery-charge.h"
|
||||
# include "sysprof-cpu-usage.h"
|
||||
# include "sysprof-diagnostic.h"
|
||||
# include "sysprof-disk-usage.h"
|
||||
# include "sysprof-energy-usage.h"
|
||||
# include "sysprof-instrument.h"
|
||||
# include "sysprof-malloc-tracing.h"
|
||||
# include "sysprof-memory-usage.h"
|
||||
# include "sysprof-network-usage.h"
|
||||
# include "sysprof-power-profile.h"
|
||||
# include "sysprof-profiler.h"
|
||||
# include "sysprof-proxied-instrument.h"
|
||||
# include "sysprof-recording.h"
|
||||
# include "sysprof-sampler.h"
|
||||
# include "sysprof-spawnable.h"
|
||||
# include "sysprof-symbols-bundle.h"
|
||||
# include "sysprof-system-logs.h"
|
||||
# include "sysprof-tracer.h"
|
||||
#undef SYSPROF_PROFILE_INSIDE
|
||||
|
||||
G_END_DECLS
|
||||
@ -1,31 +0,0 @@
|
||||
libsysprof_profile_test_env = [
|
||||
'G_DEBUG=gc-friendly',
|
||||
'GSETTINGS_BACKEND=memory',
|
||||
'MALLOC_CHECK_=2',
|
||||
]
|
||||
|
||||
libsysprof_profile_testsuite_c_args = [
|
||||
'-DG_LOG_DOMAIN="libsysprof-profile"',
|
||||
'-DG_ENABLE_DEBUG',
|
||||
'-UG_DISABLE_ASSERT',
|
||||
'-UG_DISABLE_CAST_CHECKS',
|
||||
]
|
||||
|
||||
libsysprof_profile_testsuite = {
|
||||
'test-maps-parser' : {'skip': true},
|
||||
'test-profiler' : {'skip': true},
|
||||
}
|
||||
|
||||
libsysprof_profile_testsuite_deps = [
|
||||
libsysprof_profile_static_dep,
|
||||
]
|
||||
|
||||
foreach test, params: libsysprof_profile_testsuite
|
||||
test_exe = executable(test, '@0@.c'.format(test),
|
||||
c_args: libsysprof_profile_testsuite_c_args,
|
||||
dependencies: libsysprof_profile_testsuite_deps,
|
||||
)
|
||||
if not params.get('skip', false)
|
||||
test(test, test_exe, env: libsysprof_profile_test_env)
|
||||
endif
|
||||
endforeach
|
||||
@ -1,18 +1,21 @@
|
||||
libsysprof_analyze_public_sources = [
|
||||
libsysprof_public_sources = [
|
||||
'sysprof-battery-charge.c',
|
||||
'sysprof-bundled-symbolizer.c',
|
||||
'sysprof-callgraph.c',
|
||||
'sysprof-callgraph-frame.c',
|
||||
'sysprof-callgraph-symbol.c',
|
||||
'sysprof-callgraph.c',
|
||||
'sysprof-cpu-info.c',
|
||||
'sysprof-document.c',
|
||||
'sysprof-cpu-usage.c',
|
||||
'sysprof-diagnostic.c',
|
||||
'sysprof-disk-usage.c',
|
||||
'sysprof-document-allocation.c',
|
||||
'sysprof-document-counter.c',
|
||||
'sysprof-document-counter-value.c',
|
||||
'sysprof-document-counter.c',
|
||||
'sysprof-document-ctrdef.c',
|
||||
'sysprof-document-ctrset.c',
|
||||
'sysprof-document-exit.c',
|
||||
'sysprof-document-file.c',
|
||||
'sysprof-document-file-chunk.c',
|
||||
'sysprof-document-file.c',
|
||||
'sysprof-document-fork.c',
|
||||
'sysprof-document-frame.c',
|
||||
'sysprof-document-jitmap.c',
|
||||
@ -25,34 +28,52 @@ libsysprof_analyze_public_sources = [
|
||||
'sysprof-document-process.c',
|
||||
'sysprof-document-sample.c',
|
||||
'sysprof-document-traceable.c',
|
||||
'sysprof-document.c',
|
||||
'sysprof-elf-symbolizer.c',
|
||||
'sysprof-energy-usage.c',
|
||||
'sysprof-instrument.c',
|
||||
'sysprof-jitmap-symbolizer.c',
|
||||
'sysprof-kallsyms-symbolizer.c',
|
||||
'sysprof-malloc-tracing.c',
|
||||
'sysprof-mark-catalog.c',
|
||||
'sysprof-memory-usage.c',
|
||||
'sysprof-multi-symbolizer.c',
|
||||
'sysprof-network-usage.c',
|
||||
'sysprof-no-symbolizer.c',
|
||||
'sysprof-power-profile.c',
|
||||
'sysprof-profiler.c',
|
||||
'sysprof-proxied-instrument.c',
|
||||
'sysprof-recording.c',
|
||||
'sysprof-sampler.c',
|
||||
'sysprof-spawnable.c',
|
||||
'sysprof-symbol.c',
|
||||
'sysprof-symbolizer.c',
|
||||
'sysprof-symbols-bundle.c',
|
||||
'sysprof-system-logs.c',
|
||||
'sysprof-thread-info.c',
|
||||
'sysprof-time-span.c',
|
||||
'sysprof-tracer.c',
|
||||
]
|
||||
|
||||
libsysprof_analyze_public_headers = [
|
||||
'sysprof-analyze.h',
|
||||
libsysprof_public_headers = [
|
||||
'sysprof.h',
|
||||
'sysprof-battery-charge.h',
|
||||
'sysprof-bundled-symbolizer.h',
|
||||
'sysprof-callgraph.h',
|
||||
'sysprof-callgraph-frame.h',
|
||||
'sysprof-callgraph-symbol.h',
|
||||
'sysprof-callgraph.h',
|
||||
'sysprof-cpu-info.h',
|
||||
'sysprof-document.h',
|
||||
'sysprof-cpu-usage.h',
|
||||
'sysprof-diagnostic.h',
|
||||
'sysprof-disk-usage.h',
|
||||
'sysprof-document-allocation.h',
|
||||
'sysprof-document-counter.h',
|
||||
'sysprof-document-counter-value.h',
|
||||
'sysprof-document-counter.h',
|
||||
'sysprof-document-ctrdef.h',
|
||||
'sysprof-document-ctrset.h',
|
||||
'sysprof-document-exit.h',
|
||||
'sysprof-document-file.h',
|
||||
'sysprof-document-file-chunk.h',
|
||||
'sysprof-document-file.h',
|
||||
'sysprof-document-fork.h',
|
||||
'sysprof-document-frame.h',
|
||||
'sysprof-document-jitmap.h',
|
||||
@ -65,37 +86,73 @@ libsysprof_analyze_public_headers = [
|
||||
'sysprof-document-process.h',
|
||||
'sysprof-document-sample.h',
|
||||
'sysprof-document-traceable.h',
|
||||
'sysprof-document.h',
|
||||
'sysprof-elf-symbolizer.h',
|
||||
'sysprof-energy-usage.h',
|
||||
'sysprof-instrument.h',
|
||||
'sysprof-jitmap-symbolizer.h',
|
||||
'sysprof-kallsyms-symbolizer.h',
|
||||
'sysprof-malloc-tracing.h',
|
||||
'sysprof-mark-catalog.h',
|
||||
'sysprof-memory-usage.h',
|
||||
'sysprof-mount.h',
|
||||
'sysprof-multi-symbolizer.h',
|
||||
'sysprof-network-usage.h',
|
||||
'sysprof-no-symbolizer.h',
|
||||
'sysprof-power-profile.h',
|
||||
'sysprof-profiler.h',
|
||||
'sysprof-proxied-instrument.h',
|
||||
'sysprof-recording.h',
|
||||
'sysprof-sampler.h',
|
||||
'sysprof-spawnable.h',
|
||||
'sysprof-symbol.h',
|
||||
'sysprof-symbolizer.h',
|
||||
'sysprof-symbols-bundle.h',
|
||||
'sysprof-system-logs.h',
|
||||
'sysprof-thread-info.h',
|
||||
'sysprof-time-span.h',
|
||||
'sysprof-tracer.h',
|
||||
]
|
||||
|
||||
libsysprof_analyze_private_sources = [
|
||||
libsysprof_private_sources = [
|
||||
'mapped-ring-buffer-source.c',
|
||||
'sysprof-address-layout.c',
|
||||
'sysprof-controlfd-instrument.c',
|
||||
'sysprof-descendants-model.c',
|
||||
'sysprof-document-bitset-index.c',
|
||||
'sysprof-document-symbols.c',
|
||||
'sysprof-elf.c',
|
||||
'sysprof-elf-loader.c',
|
||||
'sysprof-mount.c',
|
||||
'sysprof-elf.c',
|
||||
'sysprof-journald-source.c',
|
||||
'sysprof-maps-parser.c',
|
||||
'sysprof-mount-device.c',
|
||||
'sysprof-mount-namespace.c',
|
||||
'sysprof-mount.c',
|
||||
'sysprof-perf-event-stream.c',
|
||||
'sysprof-podman.c',
|
||||
'sysprof-process-info.c',
|
||||
'sysprof-strings.c',
|
||||
'sysprof-symbol-cache.c',
|
||||
]
|
||||
|
||||
libsysprof_analyze_deps = [
|
||||
if polkit_dep.found()
|
||||
libsysprof_private_sources += ['sysprof-polkit.c']
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'linux'
|
||||
libsysprof_private_sources += ['sysprof-linux-instrument.c']
|
||||
endif
|
||||
|
||||
libsysprof_deps = [
|
||||
dependency('gio-2.0', version: glib_req_version),
|
||||
dependency('gio-unix-2.0',
|
||||
version: glib_req_version,
|
||||
required: host_machine.system() != 'windows'),
|
||||
dependency('libdex-1', version: dex_req_version),
|
||||
dependency('json-glib-1.0'),
|
||||
|
||||
libsystemd_dep,
|
||||
polkit_dep,
|
||||
|
||||
libeggbitset_static_dep,
|
||||
libelfparser_static_dep,
|
||||
@ -103,47 +160,49 @@ libsysprof_analyze_deps = [
|
||||
libsysprof_capture_dep,
|
||||
]
|
||||
|
||||
libsysprof_analyze_static = static_library(
|
||||
libsysprof_static = static_library(
|
||||
'sysprof-analyze-@0@'.format(soname_major_version),
|
||||
libsysprof_analyze_public_sources +
|
||||
libsysprof_analyze_private_sources,
|
||||
libsysprof_public_sources +
|
||||
libsysprof_private_sources,
|
||||
|
||||
include_directories: [include_directories('.'),
|
||||
libsysprof_capture_include_dirs],
|
||||
dependencies: libsysprof_analyze_deps,
|
||||
dependencies: libsysprof_deps,
|
||||
gnu_symbol_visibility: 'hidden',
|
||||
)
|
||||
|
||||
libsysprof_analyze_static_dep = declare_dependency(
|
||||
link_with: libsysprof_analyze_static,
|
||||
dependencies: libsysprof_analyze_deps,
|
||||
libsysprof_static_dep = declare_dependency(
|
||||
link_with: libsysprof_static,
|
||||
dependencies: libsysprof_deps,
|
||||
include_directories: [include_directories('.'),
|
||||
libsysprof_capture_include_dirs],
|
||||
)
|
||||
|
||||
libsysprof_analyze = library('sysprof-analyze-@0@'.format(soname_major_version),
|
||||
dependencies: [libsysprof_analyze_static_dep],
|
||||
libsysprof = library('sysprof-analyze-@0@'.format(soname_major_version),
|
||||
dependencies: [libsysprof_static_dep],
|
||||
gnu_symbol_visibility: 'hidden',
|
||||
version: '@0@.0.0'.format(soname_major_version),
|
||||
darwin_versions: '@0@.0'.format(soname_major_version),
|
||||
install: true,
|
||||
install: get_option('libsysprof'),
|
||||
)
|
||||
|
||||
libsysprof_analyze_dep = declare_dependency(
|
||||
link_with: libsysprof_analyze,
|
||||
dependencies: libsysprof_analyze_deps,
|
||||
libsysprof_dep = declare_dependency(
|
||||
link_with: libsysprof,
|
||||
dependencies: libsysprof_deps,
|
||||
include_directories: [include_directories('.'), libsysprof_capture_include_dirs],
|
||||
)
|
||||
meson.override_dependency('sysprof-analyze-@0@'.format(soname_major_version), libsysprof_analyze_dep)
|
||||
meson.override_dependency('sysprof-analyze-@0@'.format(soname_major_version), libsysprof_dep)
|
||||
|
||||
pkgconfig.generate(libsysprof_analyze,
|
||||
pkgconfig.generate(libsysprof,
|
||||
subdirs: [sysprof_header_subdir],
|
||||
description: 'A library for processing and analyzing Sysprof captures',
|
||||
description: 'A library for recording and analyzing system performance',
|
||||
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)
|
||||
install_headers(libsysprof_public_headers, subdir: sysprof_header_subdir)
|
||||
|
||||
subdir('tests')
|
||||
if get_option('tests')
|
||||
subdir('tests')
|
||||
endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user