mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
build: add libsysprof-capture-2 static library
This allows external tooling to write capture files that Sysprof can open. Ideally, this will get used by GJS in the near future to implement profiler output for Sysprof.
This commit is contained in:
@ -16,5 +16,7 @@ capture_sources = [
|
||||
libsysprof_headers += files(capture_headers)
|
||||
libsysprof_sources += files(capture_sources)
|
||||
|
||||
libsysprof_capture_sources += files(capture_sources)
|
||||
|
||||
install_headers(capture_headers,
|
||||
subdir: join_paths(libsysprof_header_subdir, 'capture'))
|
||||
|
||||
@ -24,22 +24,27 @@ configure_file(
|
||||
|
||||
libsysprof_base_headers = [
|
||||
'sysprof.h',
|
||||
'sysprof-capture.h',
|
||||
'sp-address.h',
|
||||
'sp-clock.h',
|
||||
'sp-error.h',
|
||||
]
|
||||
|
||||
libsysprof_headers = libsysprof_base_headers
|
||||
libsysprof_sources = [
|
||||
libsysprof_base_sources = [
|
||||
'sp-address.c',
|
||||
'sp-clock.c',
|
||||
'sp-error.c',
|
||||
]
|
||||
|
||||
libsysprof_headers = libsysprof_base_headers
|
||||
libsysprof_sources = libsysprof_base_sources
|
||||
|
||||
libsysprof_ui_base_headers = ['sysprof-ui.h']
|
||||
libsysprof_ui_headers = libsysprof_ui_base_headers
|
||||
libsysprof_ui_sources = []
|
||||
|
||||
libsysprof_capture_sources = libsysprof_base_sources
|
||||
|
||||
subdir('callgraph')
|
||||
subdir('capture')
|
||||
subdir('profiler')
|
||||
@ -51,6 +56,10 @@ subdir('widgets')
|
||||
|
||||
cxx = meson.get_compiler('cpp')
|
||||
|
||||
libsysprof_capture_deps = [
|
||||
dependency('gobject-2.0'),
|
||||
]
|
||||
|
||||
libsysprof_deps = [
|
||||
cxx.find_library('stdc++'),
|
||||
dependency('gio-unix-2.0'),
|
||||
@ -64,6 +73,13 @@ if get_option('with_sysprofd') != 'none'
|
||||
libsysprof_c_args += '-DENABLE_POLKIT'
|
||||
endif
|
||||
|
||||
libsysprof_capture = static_library('sysprof-capture-' + libsysprof_api_version,
|
||||
libsysprof_capture_sources,
|
||||
dependencies: libsysprof_capture_deps,
|
||||
c_args: libsysprof_c_args,
|
||||
install: true,
|
||||
)
|
||||
|
||||
libsysprof = shared_library('sysprof-' + libsysprof_api_version,
|
||||
libsysprof_sources,
|
||||
dependencies: libsysprof_deps,
|
||||
@ -79,6 +95,12 @@ libsysprof_dep = declare_dependency(
|
||||
dependencies: libsysprof_deps,
|
||||
)
|
||||
|
||||
libsysprof_capture_dep = declare_dependency(
|
||||
include_directories: include_directories('.'),
|
||||
link_with: libsysprof_capture,
|
||||
dependencies: libsysprof_capture_deps,
|
||||
)
|
||||
|
||||
install_headers(libsysprof_base_headers, subdir: libsysprof_header_subdir)
|
||||
|
||||
if get_option('enable_gtk')
|
||||
|
||||
42
lib/sysprof-capture.h
Normal file
42
lib/sysprof-capture.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* sysprof-capture.h
|
||||
*
|
||||
* Copyright © 2018 Christian Hergert <chergert@redhat.com>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file 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 Lesser 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/>.
|
||||
*/
|
||||
|
||||
#ifndef SYSPROF_CAPTURE_H
|
||||
#define SYSPROF_CAPTURE_H
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SYSPROF_INSIDE
|
||||
|
||||
# include "sp-address.h"
|
||||
# include "sp-clock.h"
|
||||
# include "sp-error.h"
|
||||
# include "sysprof-version.h"
|
||||
|
||||
# include "capture/sp-capture-condition.h"
|
||||
# include "capture/sp-capture-cursor.h"
|
||||
# include "capture/sp-capture-reader.h"
|
||||
# include "capture/sp-capture-writer.h"
|
||||
|
||||
#undef SYSPROF_INSIDE
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* SYSPROF_CAPTURE_H */
|
||||
@ -8,7 +8,7 @@ test_env = [
|
||||
|
||||
test_capture = executable('test-capture',
|
||||
'test-capture.c',
|
||||
dependencies: libsysprof_dep,
|
||||
dependencies: libsysprof_capture_dep,
|
||||
)
|
||||
test('test-capture', test_capture, env: test_env)
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ sysprof_cli = executable('sysprof-cli',
|
||||
|
||||
sysprof_dump = executable('sysprof-dump',
|
||||
'sysprof-dump.c',
|
||||
dependencies: libsysprof_dep,
|
||||
dependencies: libsysprof_capture_dep,
|
||||
c_args: exe_c_args,
|
||||
link_args: exe_link_args,
|
||||
)
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sysprof.h>
|
||||
#include <sysprof-capture.h>
|
||||
|
||||
#define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user