linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] libtraceevent: Added support for pkg-config and few other fixes related to transfoming traceevent into a library
@ 2018-09-28  7:19 Tzvetomir Stoyanov
  2018-09-28  7:19 ` [PATCH 1/3] tools/lib/traceevent: Implemented new API tep_ref_get() Tzvetomir Stoyanov
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Tzvetomir Stoyanov @ 2018-09-28  7:19 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

Added support for pkg-config, which makes possible the library to be detected by autoconfig.
Implemented new API tep_ref_get(), used by applications to get the tep handle reference count.
Install trace-seq.h header file, which is part of the library API. 

Tzvetomir Stoyanov (3):
  tools/lib/traceevent: Implemented new API tep_ref_get()
  tools/lib/traceevent: Added support for pkg-config
  tools/lib/traceevent: Install trace-seq.h API header file

 tools/lib/traceevent/Makefile                 | 27 ++++++++++++++++---
 tools/lib/traceevent/event-parse.c            |  7 +++++
 tools/lib/traceevent/event-parse.h            |  1 +
 .../lib/traceevent/libtraceevent.pc.template  | 10 +++++++
 4 files changed, 42 insertions(+), 3 deletions(-)
 create mode 100644 tools/lib/traceevent/libtraceevent.pc.template

-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] tools/lib/traceevent: Implemented new API tep_ref_get()
  2018-09-28  7:19 [PATCH 0/3] libtraceevent: Added support for pkg-config and few other fixes related to transfoming traceevent into a library Tzvetomir Stoyanov
@ 2018-09-28  7:19 ` Tzvetomir Stoyanov
  2018-11-20  3:54   ` Steven Rostedt
  2018-09-28  7:19 ` [PATCH 2/3] tools/lib/traceevent: Added support for pkg-config Tzvetomir Stoyanov
  2018-09-28  7:19 ` [PATCH 3/3] tools/lib/traceevent: Install trace-seq.h API header file Tzvetomir Stoyanov
  2 siblings, 1 reply; 8+ messages in thread
From: Tzvetomir Stoyanov @ 2018-09-28  7:19 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

This patch implements new API of the tracevent library:
int tep_ref_get(struct tep_handle *pevent);
The API returns the reference counter "ref_count" of the tep handler.
As "struct tep_handle" is internal only, its members cannot be accessed
by the library users, the API is used to get the reference counter.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 tools/lib/traceevent/event-parse.c | 7 +++++++
 tools/lib/traceevent/event-parse.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index f327c990dedc..aa26d0e7c074 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -6774,6 +6774,13 @@ void tep_ref(struct tep_handle *pevent)
 	pevent->ref_count++;
 }
 
+int tep_ref_get(struct tep_handle *pevent)
+{
+	if (pevent)
+		return pevent->ref_count;
+	return 0;
+}
+
 void tep_free_format_field(struct tep_format_field *field)
 {
 	free(field->type);
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 100b0b7b29fc..cda21a67160e 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -577,6 +577,7 @@ struct tep_handle *tep_alloc(void);
 void tep_free(struct tep_handle *pevent);
 void tep_ref(struct tep_handle *pevent);
 void tep_unref(struct tep_handle *pevent);
+int tep_ref_get(struct tep_handle *pevent);
 
 /* access to the internal parser */
 void tep_buffer_init(const char *buf, unsigned long long size);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] tools/lib/traceevent: Added support for pkg-config
  2018-09-28  7:19 [PATCH 0/3] libtraceevent: Added support for pkg-config and few other fixes related to transfoming traceevent into a library Tzvetomir Stoyanov
  2018-09-28  7:19 ` [PATCH 1/3] tools/lib/traceevent: Implemented new API tep_ref_get() Tzvetomir Stoyanov
@ 2018-09-28  7:19 ` Tzvetomir Stoyanov
  2018-09-28  8:11   ` Slavomir Kaslev
  2018-11-20  4:01   ` Steven Rostedt
  2018-09-28  7:19 ` [PATCH 3/3] tools/lib/traceevent: Install trace-seq.h API header file Tzvetomir Stoyanov
  2 siblings, 2 replies; 8+ messages in thread
From: Tzvetomir Stoyanov @ 2018-09-28  7:19 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

This patch implements integration with pkg-config framework.
pkg-config can be used by the library users to determine
required CFLAGS and LDFLAGS in order to use the library

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 tools/lib/traceevent/Makefile                 | 26 ++++++++++++++++---
 .../lib/traceevent/libtraceevent.pc.template  | 10 +++++++
 2 files changed, 33 insertions(+), 3 deletions(-)
 create mode 100644 tools/lib/traceevent/libtraceevent.pc.template

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 0b4e833088a4..05ac0ec9bcd1 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -25,6 +25,7 @@ endef
 $(call allow-override,CC,$(CROSS_COMPILE)gcc)
 $(call allow-override,AR,$(CROSS_COMPILE)ar)
 $(call allow-override,NM,$(CROSS_COMPILE)nm)
+$(call allow-override,PKG_CONFIG,pkg-config)
 
 EXT = -std=gnu99
 INSTALL = install
@@ -47,6 +48,8 @@ prefix ?= /usr/local
 libdir = $(prefix)/$(libdir_relative)
 man_dir = $(prefix)/share/man
 man_dir_SQ = '$(subst ','\'',$(man_dir))'
+pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG) 		\
+			--variable pc_path pkg-config | tr ":" " "))
 
 export man_dir man_dir_SQ INSTALL
 export DESTDIR DESTDIR_SQ
@@ -270,7 +273,19 @@ define do_generate_dynamic_list_file
 	fi
 endef
 
-install_lib: all_cmd install_plugins
+PKG_CONFIG_FILE = libtraceevent.pc
+define do_install_pkgconfig_file
+	if [ -n "${pkgconfig_dir}" ]; then 					\
+		cp -f ${PKG_CONFIG_FILE}.template ${PKG_CONFIG_FILE}; 		\
+		sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; 		\
+		sed -i "s|LIB_VERSION|${EVENT_PARSE_VERSION}|g" ${PKG_CONFIG_FILE}; \
+		$(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644); 	\
+	else 									\
+		(echo Failed to locate pkg-config directory) 1>&2;		\
+	fi	
+endef
+
+install_lib: all_cmd install_plugins install_pkgconfig
 	$(call QUIET_INSTALL, $(LIB_TARGET)) \
 		$(call do_install_mkdir,$(libdir_SQ)); \
 		cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
@@ -279,6 +294,10 @@ install_plugins: $(PLUGINS)
 	$(call QUIET_INSTALL, trace_plugins) \
 		$(call do_install_plugins, $(PLUGINS))
 
+install_pkgconfig:
+	$(call QUIET_INSTALL, $(PKG_CONFIG_FILE)) \
+		$(call do_install_pkgconfig_file,$(prefix))
+
 install_headers:
 	$(call QUIET_INSTALL, headers) \
 		$(call do_install,event-parse.h,$(prefix)/include/traceevent,644); \
@@ -289,8 +308,9 @@ install: install_lib
 
 clean:
 	$(call QUIET_CLEAN, libtraceevent) \
-		$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \
-		$(RM) TRACEEVENT-CFLAGS tags TAGS
+		$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \
+		$(RM) TRACEEVENT-CFLAGS tags TAGS; \
+		$(RM) $(PKG_CONFIG_FILE)
 
 PHONY += force plugins
 force:
diff --git a/tools/lib/traceevent/libtraceevent.pc.template b/tools/lib/traceevent/libtraceevent.pc.template
new file mode 100644
index 000000000000..7e5078aadf85
--- /dev/null
+++ b/tools/lib/traceevent/libtraceevent.pc.template
@@ -0,0 +1,10 @@
+prefix=INSTALL_PREFIX
+libdir=${prefix}/lib64
+includedir=${prefix}/include/traceevent
+
+Name: libtraceevent
+URL: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git/about/
+Description: traceevent library
+Version: LIB_VERSION
+Cflags: -I${includedir}
+Libs: -L${libdir} -ltraceevent
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] tools/lib/traceevent: Install trace-seq.h API header file
  2018-09-28  7:19 [PATCH 0/3] libtraceevent: Added support for pkg-config and few other fixes related to transfoming traceevent into a library Tzvetomir Stoyanov
  2018-09-28  7:19 ` [PATCH 1/3] tools/lib/traceevent: Implemented new API tep_ref_get() Tzvetomir Stoyanov
  2018-09-28  7:19 ` [PATCH 2/3] tools/lib/traceevent: Added support for pkg-config Tzvetomir Stoyanov
@ 2018-09-28  7:19 ` Tzvetomir Stoyanov
  2 siblings, 0 replies; 8+ messages in thread
From: Tzvetomir Stoyanov @ 2018-09-28  7:19 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

This patch installs trace-seq.h header file on "make install".

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 tools/lib/traceevent/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 05ac0ec9bcd1..f65243137d6d 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -285,7 +285,7 @@ define do_install_pkgconfig_file
 	fi	
 endef
 
-install_lib: all_cmd install_plugins install_pkgconfig
+install_lib: all_cmd install_plugins install_headers install_pkgconfig
 	$(call QUIET_INSTALL, $(LIB_TARGET)) \
 		$(call do_install_mkdir,$(libdir_SQ)); \
 		cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
@@ -302,6 +302,7 @@ install_headers:
 	$(call QUIET_INSTALL, headers) \
 		$(call do_install,event-parse.h,$(prefix)/include/traceevent,644); \
 		$(call do_install,event-utils.h,$(prefix)/include/traceevent,644); \
+		$(call do_install,trace-seq.h,$(prefix)/include/traceevent,644); \
 		$(call do_install,kbuffer.h,$(prefix)/include/traceevent,644)
 
 install: install_lib
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] tools/lib/traceevent: Added support for pkg-config
  2018-09-28  7:19 ` [PATCH 2/3] tools/lib/traceevent: Added support for pkg-config Tzvetomir Stoyanov
@ 2018-09-28  8:11   ` Slavomir Kaslev
  2018-11-20  4:01   ` Steven Rostedt
  1 sibling, 0 replies; 8+ messages in thread
From: Slavomir Kaslev @ 2018-09-28  8:11 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: rostedt, linux-trace-devel

On Fri, Sep 28, 2018 at 10:20 AM Tzvetomir Stoyanov
<tstoyanov@vmware.com> wrote:
>
> This patch implements integration with pkg-config framework.
> pkg-config can be used by the library users to determine
> required CFLAGS and LDFLAGS in order to use the library
>
> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> ---
>  tools/lib/traceevent/Makefile                 | 26 ++++++++++++++++---
>  .../lib/traceevent/libtraceevent.pc.template  | 10 +++++++
>  2 files changed, 33 insertions(+), 3 deletions(-)
>  create mode 100644 tools/lib/traceevent/libtraceevent.pc.template
>
> diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> index 0b4e833088a4..05ac0ec9bcd1 100644
> --- a/tools/lib/traceevent/Makefile
> +++ b/tools/lib/traceevent/Makefile
> @@ -25,6 +25,7 @@ endef
>  $(call allow-override,CC,$(CROSS_COMPILE)gcc)
>  $(call allow-override,AR,$(CROSS_COMPILE)ar)
>  $(call allow-override,NM,$(CROSS_COMPILE)nm)
> +$(call allow-override,PKG_CONFIG,pkg-config)
>
>  EXT = -std=gnu99
>  INSTALL = install
> @@ -47,6 +48,8 @@ prefix ?= /usr/local
>  libdir = $(prefix)/$(libdir_relative)
>  man_dir = $(prefix)/share/man
>  man_dir_SQ = '$(subst ','\'',$(man_dir))'
> +pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG)                \
> +                       --variable pc_path pkg-config | tr ":" " "))
>
>  export man_dir man_dir_SQ INSTALL
>  export DESTDIR DESTDIR_SQ
> @@ -270,7 +273,19 @@ define do_generate_dynamic_list_file
>         fi
>  endef
>
> -install_lib: all_cmd install_plugins
> +PKG_CONFIG_FILE = libtraceevent.pc
> +define do_install_pkgconfig_file
> +       if [ -n "${pkgconfig_dir}" ]; then                                      \
> +               cp -f ${PKG_CONFIG_FILE}.template ${PKG_CONFIG_FILE};           \
> +               sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE};            \
> +               sed -i "s|LIB_VERSION|${EVENT_PARSE_VERSION}|g" ${PKG_CONFIG_FILE}; \
> +               $(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644);     \
> +       else                                                                    \
> +               (echo Failed to locate pkg-config directory) 1>&2;              \
> +       fi
> +endef
> +
> +install_lib: all_cmd install_plugins install_pkgconfig
>         $(call QUIET_INSTALL, $(LIB_TARGET)) \
>                 $(call do_install_mkdir,$(libdir_SQ)); \
>                 cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
> @@ -279,6 +294,10 @@ install_plugins: $(PLUGINS)
>         $(call QUIET_INSTALL, trace_plugins) \
>                 $(call do_install_plugins, $(PLUGINS))
>
> +install_pkgconfig:
> +       $(call QUIET_INSTALL, $(PKG_CONFIG_FILE)) \
> +               $(call do_install_pkgconfig_file,$(prefix))
> +
>  install_headers:
>         $(call QUIET_INSTALL, headers) \
>                 $(call do_install,event-parse.h,$(prefix)/include/traceevent,644); \
> @@ -289,8 +308,9 @@ install: install_lib
>
>  clean:
>         $(call QUIET_CLEAN, libtraceevent) \
> -               $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \
> -               $(RM) TRACEEVENT-CFLAGS tags TAGS
> +               $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \
> +               $(RM) TRACEEVENT-CFLAGS tags TAGS; \
> +               $(RM) $(PKG_CONFIG_FILE)
>
>  PHONY += force plugins
>  force:
> diff --git a/tools/lib/traceevent/libtraceevent.pc.template b/tools/lib/traceevent/libtraceevent.pc.template
> new file mode 100644
> index 000000000000..7e5078aadf85
> --- /dev/null
> +++ b/tools/lib/traceevent/libtraceevent.pc.template
> @@ -0,0 +1,10 @@
> +prefix=INSTALL_PREFIX
> +libdir=${prefix}/lib64
> +includedir=${prefix}/include/traceevent
> +
> +Name: libtraceevent
> +URL: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git/about/

Shouldn't this rather point to the official repo at
https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/about ?

> +Description: traceevent library
> +Version: LIB_VERSION
> +Cflags: -I${includedir}
> +Libs: -L${libdir} -ltraceevent
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] tools/lib/traceevent: Implemented new API tep_ref_get()
  2018-09-28  7:19 ` [PATCH 1/3] tools/lib/traceevent: Implemented new API tep_ref_get() Tzvetomir Stoyanov
@ 2018-11-20  3:54   ` Steven Rostedt
  2018-11-20  8:05     ` Tzvetomir Stoyanov
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2018-11-20  3:54 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: linux-trace-devel

On Fri, 28 Sep 2018 10:19:38 +0300
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> This patch implements new API of the tracevent library:
> int tep_ref_get(struct tep_handle *pevent);
> The API returns the reference counter "ref_count" of the tep handler.
> As "struct tep_handle" is internal only, its members cannot be accessed
> by the library users, the API is used to get the reference counter.
> 
> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> ---
>  tools/lib/traceevent/event-parse.c | 7 +++++++
>  tools/lib/traceevent/event-parse.h | 1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index f327c990dedc..aa26d0e7c074 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -6774,6 +6774,13 @@ void tep_ref(struct tep_handle *pevent)
>  	pevent->ref_count++;
>  }
>  
> +int tep_ref_get(struct tep_handle *pevent)

Hmm, I'm thinking we should call this "tep_get_ref" as that fits more
the naming convention of the Linux kernel.

-- Steve


> +{
> +	if (pevent)
> +		return pevent->ref_count;
> +	return 0;
> +}
> +
>  void tep_free_format_field(struct tep_format_field *field)
>  {
>  	free(field->type);
> diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
> index 100b0b7b29fc..cda21a67160e 100644
> --- a/tools/lib/traceevent/event-parse.h
> +++ b/tools/lib/traceevent/event-parse.h
> @@ -577,6 +577,7 @@ struct tep_handle *tep_alloc(void);
>  void tep_free(struct tep_handle *pevent);
>  void tep_ref(struct tep_handle *pevent);
>  void tep_unref(struct tep_handle *pevent);
> +int tep_ref_get(struct tep_handle *pevent);
>  
>  /* access to the internal parser */
>  void tep_buffer_init(const char *buf, unsigned long long size);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] tools/lib/traceevent: Added support for pkg-config
  2018-09-28  7:19 ` [PATCH 2/3] tools/lib/traceevent: Added support for pkg-config Tzvetomir Stoyanov
  2018-09-28  8:11   ` Slavomir Kaslev
@ 2018-11-20  4:01   ` Steven Rostedt
  1 sibling, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2018-11-20  4:01 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: linux-trace-devel

On Fri, 28 Sep 2018 10:19:39 +0300
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> This patch implements integration with pkg-config framework.
> pkg-config can be used by the library users to determine
> required CFLAGS and LDFLAGS in order to use the library

Do we still need this patch. I thought that there was some issue with
PowerTop where this wasn't working. If you think it's still useful then
we'll keep it.

Thanks!

-- Steve

> 
> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> ---
>  tools/lib/traceevent/Makefile                 | 26 ++++++++++++++++---
>  .../lib/traceevent/libtraceevent.pc.template  | 10 +++++++
>  2 files changed, 33 insertions(+), 3 deletions(-)
>  create mode 100644 tools/lib/traceevent/libtraceevent.pc.template
> 
> diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> index 0b4e833088a4..05ac0ec9bcd1 100644
> --- a/tools/lib/traceevent/Makefile
> +++ b/tools/lib/traceevent/Makefile
> @@ -25,6 +25,7 @@ endef
>  $(call allow-override,CC,$(CROSS_COMPILE)gcc)
>  $(call allow-override,AR,$(CROSS_COMPILE)ar)
>  $(call allow-override,NM,$(CROSS_COMPILE)nm)
> +$(call allow-override,PKG_CONFIG,pkg-config)
>  
>  EXT = -std=gnu99
>  INSTALL = install
> @@ -47,6 +48,8 @@ prefix ?= /usr/local
>  libdir = $(prefix)/$(libdir_relative)
>  man_dir = $(prefix)/share/man
>  man_dir_SQ = '$(subst ','\'',$(man_dir))'
> +pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG) 		\
> +			--variable pc_path pkg-config | tr ":" " "))
>  
>  export man_dir man_dir_SQ INSTALL
>  export DESTDIR DESTDIR_SQ
> @@ -270,7 +273,19 @@ define do_generate_dynamic_list_file
>  	fi
>  endef
>  
> -install_lib: all_cmd install_plugins
> +PKG_CONFIG_FILE = libtraceevent.pc
> +define do_install_pkgconfig_file
> +	if [ -n "${pkgconfig_dir}" ]; then 					\
> +		cp -f ${PKG_CONFIG_FILE}.template ${PKG_CONFIG_FILE}; 		\
> +		sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; 		\
> +		sed -i "s|LIB_VERSION|${EVENT_PARSE_VERSION}|g" ${PKG_CONFIG_FILE}; \
> +		$(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644); 	\
> +	else 									\
> +		(echo Failed to locate pkg-config directory) 1>&2;		\
> +	fi	
> +endef
> +
> +install_lib: all_cmd install_plugins install_pkgconfig
>  	$(call QUIET_INSTALL, $(LIB_TARGET)) \
>  		$(call do_install_mkdir,$(libdir_SQ)); \
>  		cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
> @@ -279,6 +294,10 @@ install_plugins: $(PLUGINS)
>  	$(call QUIET_INSTALL, trace_plugins) \
>  		$(call do_install_plugins, $(PLUGINS))
>  
> +install_pkgconfig:
> +	$(call QUIET_INSTALL, $(PKG_CONFIG_FILE)) \
> +		$(call do_install_pkgconfig_file,$(prefix))
> +
>  install_headers:
>  	$(call QUIET_INSTALL, headers) \
>  		$(call do_install,event-parse.h,$(prefix)/include/traceevent,644); \
> @@ -289,8 +308,9 @@ install: install_lib
>  
>  clean:
>  	$(call QUIET_CLEAN, libtraceevent) \
> -		$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \
> -		$(RM) TRACEEVENT-CFLAGS tags TAGS
> +		$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \
> +		$(RM) TRACEEVENT-CFLAGS tags TAGS; \
> +		$(RM) $(PKG_CONFIG_FILE)
>  
>  PHONY += force plugins
>  force:
> diff --git a/tools/lib/traceevent/libtraceevent.pc.template b/tools/lib/traceevent/libtraceevent.pc.template
> new file mode 100644
> index 000000000000..7e5078aadf85
> --- /dev/null
> +++ b/tools/lib/traceevent/libtraceevent.pc.template
> @@ -0,0 +1,10 @@
> +prefix=INSTALL_PREFIX
> +libdir=${prefix}/lib64
> +includedir=${prefix}/include/traceevent
> +
> +Name: libtraceevent
> +URL: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git/about/
> +Description: traceevent library
> +Version: LIB_VERSION
> +Cflags: -I${includedir}
> +Libs: -L${libdir} -ltraceevent

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] tools/lib/traceevent: Implemented new API tep_ref_get()
  2018-11-20  3:54   ` Steven Rostedt
@ 2018-11-20  8:05     ` Tzvetomir Stoyanov
  0 siblings, 0 replies; 8+ messages in thread
From: Tzvetomir Stoyanov @ 2018-11-20  8:05 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

On Tue, Nov 20, 2018 at 5:54 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Fri, 28 Sep 2018 10:19:38 +0300
> Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:
>
> > This patch implements new API of the tracevent library:
> > int tep_ref_get(struct tep_handle *pevent);
> > The API returns the reference counter "ref_count" of the tep handler.
> > As "struct tep_handle" is internal only, its members cannot be accessed
> > by the library users, the API is used to get the reference counter.
> >
> > Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> > ---
> >  tools/lib/traceevent/event-parse.c | 7 +++++++
> >  tools/lib/traceevent/event-parse.h | 1 +
> >  2 files changed, 8 insertions(+)
> >
> > diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> > index f327c990dedc..aa26d0e7c074 100644
> > --- a/tools/lib/traceevent/event-parse.c
> > +++ b/tools/lib/traceevent/event-parse.c
> > @@ -6774,6 +6774,13 @@ void tep_ref(struct tep_handle *pevent)
> >       pevent->ref_count++;
> >  }
> >
> > +int tep_ref_get(struct tep_handle *pevent)
>
> Hmm, I'm thinking we should call this "tep_get_ref" as that fits more
> the naming convention of the Linux kernel.
>
> -- Steve

Ok, going to send a V2 of this patch



>
> > +{
> > +     if (pevent)
> > +             return pevent->ref_count;
> > +     return 0;
> > +}
> > +
> >  void tep_free_format_field(struct tep_format_field *field)
> >  {
> >       free(field->type);
> > diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
> > index 100b0b7b29fc..cda21a67160e 100644
> > --- a/tools/lib/traceevent/event-parse.h
> > +++ b/tools/lib/traceevent/event-parse.h
> > @@ -577,6 +577,7 @@ struct tep_handle *tep_alloc(void);
> >  void tep_free(struct tep_handle *pevent);
> >  void tep_ref(struct tep_handle *pevent);
> >  void tep_unref(struct tep_handle *pevent);
> > +int tep_ref_get(struct tep_handle *pevent);
> >
> >  /* access to the internal parser */
> >  void tep_buffer_init(const char *buf, unsigned long long size);
>


-- 

Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-11-20 18:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-28  7:19 [PATCH 0/3] libtraceevent: Added support for pkg-config and few other fixes related to transfoming traceevent into a library Tzvetomir Stoyanov
2018-09-28  7:19 ` [PATCH 1/3] tools/lib/traceevent: Implemented new API tep_ref_get() Tzvetomir Stoyanov
2018-11-20  3:54   ` Steven Rostedt
2018-11-20  8:05     ` Tzvetomir Stoyanov
2018-09-28  7:19 ` [PATCH 2/3] tools/lib/traceevent: Added support for pkg-config Tzvetomir Stoyanov
2018-09-28  8:11   ` Slavomir Kaslev
2018-11-20  4:01   ` Steven Rostedt
2018-09-28  7:19 ` [PATCH 3/3] tools/lib/traceevent: Install trace-seq.h API header file Tzvetomir Stoyanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).