trace-cmd: A few udpates
v2 cover trace-cmd: A few udpates
Take two. Changes in this version:
- moved the print of the installation of the ld.conf.d file only if it installs
- fixed the update to the ld.conf.d install script as it was added to the wrong commit.
Steven Rostedt (VMware) (5):
trace-cmd: Create TRACECMD_MAGIC macro for magic number of trace-cmd data file
trace-cmd: Place "trace.dat" into the macro DEFAULT_INPUT_FILE
trace-cmd: Add installation of ld.conf.d file for library paths
trace-cmd: Have libtracecmd.so include libtraceevent
trace-cmd: Remove unused trace_util function declarations
----
Makefile | 6 +++++- include/trace-cmd/trace-cmd.h | 13 ++----------- lib/trace-cmd/Makefile | 2 ++ lib/trace-cmd/trace-input.c | 2 +- scripts/utils.mk | 12 +++++++++++- tracecmd/include/trace-local.h | 1 + tracecmd/trace-dump.c | 6 ++---- tracecmd/trace-hist.c | 2 +- tracecmd/trace-mem.c | 2 +- tracecmd/trace-read.c | 2 +- tracecmd/trace-record.c | 2 +- tracecmd/trace-restore.c | 2 +- tracecmd/trace-split.c | 2 +- 13 files changed, 30 insertions(+), 24 deletions(-)
PATCH v2 1/5 trace-cmd: Create TRACECMD_MAGIC macro for magic number of trace-cmd data file
From: "Steven Rostedt (VMware)" <[email protected]>
Instead of copying the magic number around different files, just declare a macro for it in the exported trace-cmd header and use that.
--- include/trace-cmd/trace-cmd.h | 2 ++ lib/trace-cmd/trace-input.c | 2 +- tracecmd/trace-dump.c | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-)
include/trace-cmd/trace-cmd.h +2 -0
@@ -8,6 +8,8 @@#include "traceevent/event-parse.h" +#define TRACECMD_MAGIC { 23, 8, 68 } +#define ARRAY_SIZE (_a) (sizeof(_a) / sizeof((_a)[0]))#define __weak __attribute__((weak))#define __noreturn __attribute__((noreturn))
lib/trace-cmd/trace-input.c +1 -1
@@ -2861,7 +2861,7 @@ struct hook_list *tracecmd_hooks(struct tracecmd_input *handle)struct tracecmd_input *tracecmd_alloc_fd (int fd) {struct tracecmd_input *handle; -char test[] = {23 ,8 ,68 }; +char test[] =TRACECMD_MAGIC ;unsigned int page_size;char *version;char buf[BUFSIZ ];
tracecmd/trace-dump.c +1 -2
@@ -14,7 +14,6 @@#include "trace-local.h" #define DEF_INPUT_FILE "trace.dat" -#define MAGIC_HEAD { 0x17, 0x08, 0x44 }#define TRACING_STR "tracing"#define HEAD_PAGE_STR "header_page"#define HEAD_PAGE_EVENT "header_event"
@@ -142,7 +141,7 @@ static int read_file_number(int fd, void *digit, int size)static void dump_initial_format (int fd) { -char magic[] =MAGIC_HEAD ; +char magic[] =TRACECMD_MAGIC ;char buf[DUMP_SIZE ];int val4;
Signature · 1 line
2.24.1
PATCH v2 2/5 trace-cmd: Place "trace.dat" into the macro DEFAULT_INPUT_FILE
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
The trace-cmd commands default the input/output file as "trace.dat". Instead of using the open coded string, make a macro to use instead.
--- tracecmd/include/trace-local.h | 1 + tracecmd/trace-dump.c | 3 +-- tracecmd/trace-hist.c | 2 +- tracecmd/trace-mem.c | 2 +- tracecmd/trace-read.c | 2 +- tracecmd/trace-record.c | 2 +- tracecmd/trace-restore.c | 2 +- tracecmd/trace-split.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-)
tracecmd/include/trace-local.h +1 -0
@@ -14,6 +14,7 @@#define TRACE_AGENT_DEFAULT_PORT 823 +#define DEFAUT_INPUT_FILE "trace.dat"#define GUEST_PIPE_NAME "trace-pipe-cpu"#define GUEST_DIR_FMT "/var/lib/trace-cmd/virt/%s"#define GUEST_FIFO_FMT GUEST_DIR_FMT "/" GUEST_PIPE_NAME "%d"
tracecmd/trace-dump.c +1 -2
@@ -13,7 +13,6 @@#include "trace-local.h" -#define DEF_INPUT_FILE "trace.dat"#define TRACING_STR "tracing"#define HEAD_PAGE_STR "header_page"#define HEAD_PAGE_EVENT "header_event"
@@ -602,7 +601,7 @@ void trace_dump(int argc, char **argv) }if (!input_file) - input_file =DEF_INPUT_FILE ; + input_file =DEFAUT_INPUT_FILE ;if (!verbosity && !validate) verbosity =SUMMARY ;
tracecmd/trace-hist.c +1 -1
@@ -1037,7 +1037,7 @@ void trace_hist(int argc, char **argv) }if (!input_file) - input_file ="trace.dat" ; + input_file =DEFAUT_INPUT_FILE ; handle =tracecmd_alloc (input_file);if (!handle)
tracecmd/trace-mem.c +1 -1
@@ -548,7 +548,7 @@ void trace_mem(int argc, char **argv) }if (!input_file) - input_file ="trace.dat" ; + input_file =DEFAUT_INPUT_FILE ; handle =tracecmd_alloc (input_file);if (!handle)
tracecmd/trace-read.c +1 -1
@@ -74,7 +74,7 @@ struct pid_list *comm_list;static unsigned int page_size;static int input_fd; -static const char *default_input_file ="trace.dat" ; +static const char *default_input_file =DEFAUT_INPUT_FILE ;static const char *input_file;static int multi_inputs;static int max_file_size;
tracecmd/trace-record.c +1 -1
@@ -68,7 +68,7 @@ static int rt_prio;static int keep; -static const char *output_file ="trace.dat" ; +static const char *output_file =DEFAUT_INPUT_FILE ;static int latency;static int sleep_time =1000 ;
tracecmd/trace-restore.c +1 -1
@@ -25,7 +25,7 @@void trace_restore (int argc,char **argv) {struct tracecmd_output *handle; -const char *output_file ="trace.dat" ; +const char *output_file =DEFAUT_INPUT_FILE ;const char *output =NULL ;const char *input =NULL ;const char *tracing_dir =NULL ;
tracecmd/trace-split.c +1 -1
@@ -23,7 +23,7 @@#include "trace-local.h" static unsigned int page_size; -static const char *default_input_file ="trace.dat" ; +static const char *default_input_file =DEFAUT_INPUT_FILE ;static const char *input_file;enum split_types {
Signature · 1 line
2.24.1
PATCH v2 3/5 trace-cmd: Add installation of ld.conf.d file for library paths
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
As just installing the shared libraries is not enough to have them accessed by the applications, ldconfig needs to also be run. To find the location of the libraries, their paths need to be added to ld.conf.d directory configuration file.
--- Makefile | 4 ++++ scripts/utils.mk | 10 ++++++++++ 2 files changed, 14 insertions(+)
Makefile +4 -0
@@ -88,6 +88,8 @@ HELP_DIR_SQ = '$(subst ','\'',$(HELP_DIR))' #' emacs highlighting gets confused by the above escaped quote. BASH_COMPLETE_DIR ?= /etc/bash_completion.d +LD_SO_CONF_DIR ?= /etc/ld.so.conf.d +TRACE_LD_FILE ?= trace.conf export PLUGIN_DIR_TRACEEVENT export PLUGIN_DIR_TRACECMD
@@ -380,6 +382,8 @@ install_libs: libs $(Q)$(call do_install,$(src)/include/traceevent/trace-seq.h,$(includedir_SQ)/traceevent) $(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd) $(Q)$(call do_install,$(src)/include/trace-cmd/trace-filter-hash.h,$(includedir_SQ)/trace-cmd) + $(Q)$(call do_install_ld,$(TRACE_LD_FILE),$(LD_SO_CONF_DIR),$(libdir_SQ)/trace-cmd) + $(Q)$(call do_install_ld,$(TRACE_LD_FILE),$(LD_SO_CONF_DIR),$(libdir_SQ)/traceevent) doc: $(MAKE) -C $(src)/Documentation all
scripts/utils.mk +10 -0
@@ -133,3 +133,13 @@ define do_install_data fi; \ $(INSTALL) -m 644 $1 '$(DESTDIR_SQ)$2' endef + +define do_install_ld + if [ -d '$(DESTDIR_SQ)$2' ]; then \ + $(print_install) \ + if ! grep -q $3 $(DESTDIR_SQ)$2/$1 2>/dev/null; then \ + echo '$3' >> $(DESTDIR_SQ)$2/$1; \ + ldconfig; \ + fi \ + fi +endef
Signature · 1 line
2.24.1
PATCH v2 4/5 trace-cmd: Have libtracecmd.so include libtraceevent
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
Was getting errors with loading libtracecmd.so with undefined symbols from libtraceevent. Add it to the build process to include what it uses as well.
--- Makefile | 2 +- lib/trace-cmd/Makefile | 2 ++ scripts/utils.mk | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-)
Makefile +1 -1
@@ -301,7 +301,7 @@ $(LIBTRACEEVENT_STATIC): force $(obj)/lib/traceevent/plugins/trace_python_dir \ $(LIBTRACECMD_STATIC): force $(Q)$(MAKE) -C $(src)/lib/trace-cmd $@ -$(LIBTRACECMD_SHARED): force +$(LIBTRACECMD_SHARED): force $(LIBTRACEEVENT_SHARED) $(Q)$(MAKE) -C $(src)/lib/trace-cmd $@ libtraceevent.so: $(LIBTRACEEVENT_SHARED)
lib/trace-cmd/Makefile +2 -0
@@ -35,6 +35,8 @@ $(DEPS): | $(bdir) $(bdir)/libtracecmd.a: $(OBJS) $(Q)$(call do_build_static_lib) +LIBS = -L$(obj)/lib/traceevent -ltraceevent + $(bdir)/libtracecmd.so: $(OBJS) $(Q)$(call do_compile_shared_library)
scripts/utils.mk +1 -1
@@ -61,7 +61,7 @@ do_build_static_lib = \ do_compile_shared_library = \ ($(print_shared_lib_compile) \ - $(CC) --shared $^ -Wl,-soname,$(@F) -o $@) + $(CC) --shared $^ $(LIBS) -Wl,-soname,$(@F) -o $@) do_compile_plugin_obj = \ ($(print_plugin_obj_compile) \
Signature · 1 line
2.24.1
PATCH v2 5/5 trace-cmd: Remove unused trace_util function declarations
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
Due to conflict resolutions, pulling in a patch to add VM tracing protocol messages also accidentally pulled in old declarations that were previously deleted. This caused ctracecmd.so python helper to reference them and fail to load python modules because of their absence.
--- include/trace-cmd/trace-cmd.h | 11 ----------- 1 file changed, 11 deletions(-)
include/trace-cmd/trace-cmd.h +0 -11
@@ -398,17 +398,6 @@ int tracecmd_msg_recv_trace_resp(struct tracecmd_msg_handle *msg_handle,/* --- Plugin handling --- */ extern struct tep_plugin_option trace_ftrace_options[]; -int trace_util_add_options (const char *name,struct tep_plugin_option *options); -void trace_util_remove_options (struct tep_plugin_option *options); -int trace_util_add_option (const char *name,const char *val); -int trace_util_load_plugins (struct tep_handle *pevent,const char *suffix, -int (*load_plugin)(struct tep_handle *pevent, -const char *path, -const char *name, -void *data), -void *data); -struct tep_plugin_option *trace_util_read_plugin_options (void ); -void trace_util_free_options (struct tep_plugin_option *options);char **trace_util_find_plugin_files (const char *suffix);void trace_util_free_plugin_files (char **files);
Signature · 1 line
2.24.1