Commit 553c481a authored by Thomas Applencourt's avatar Thomas Applencourt
Browse files

Move tally in xprof

parent 7efe6885
......@@ -132,9 +132,7 @@ libCLProf_la_SOURCES = \
clinterval.h \
clinterval.c \
clinterval_helpers.h \
clinterval_callbacks_state.h \
cltally.h \
cltally.c
clinterval_callbacks_state.h
libCLProf_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(srcdir)/include -I./
libCLProf_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
......
#include <babeltrace2/babeltrace.h>
#include "clinterval.h"
#include "cltally.h"
/* Mandatory */
BT_PLUGIN_MODULE();
......@@ -21,13 +20,3 @@ BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD(
BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD(interval,
clinterval_dispatch_message_iterator_finalize);
//~ ~ ~
// Sink Tally
//~ ~ ~
BT_PLUGIN_SINK_COMPONENT_CLASS(tally, cltally_dispatch_consume);
BT_PLUGIN_SINK_COMPONENT_CLASS_INITIALIZE_METHOD(tally, cltally_dispatch_initialize);
//BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD(tally, cltally_dispatch_finalize);
BT_PLUGIN_SINK_COMPONENT_CLASS_GRAPH_IS_CONFIGURED_METHOD(tally, cltally_dispatch_graph_is_configured);
bin_SCRIPTS = iprof
.DELETE_ON_ERROR:
BUILT_SOURCES = xprof.c
bin_SCRIPTS = iprof
iprof: $(top_builddir)/utils/xprof.sh.erb
$(ERB) -T 1 languages=["opencl","ze"] $(top_builddir)/utils/xprof.sh.erb > $@
chmod a+x $@
# Library to be packaged
lib_LTLIBRARIES = libXProf.la
# File to compiled
libXProf_la_SOURCES = \
xprof.c \
tally.h \
tally.cpp
# Compiler flags
libXProf_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(srcdir)/include -I./
libXProf_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
libXProf_la_CXXFLAGS = -std=c++17 -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
libXProf_la_LDFLAGS = $(BABELTRACE2_LIBS) -avoid-version -module
# Cannot use check_LTLIBRARIES because we need the shared version of those
# Thanks Vincent Danjean
# noinst_LTLIBRARIES would be the correct thing but then libtool
# only built non shared version :-( So, declaring the libs as
# pkglib_LTLIBRARIES and using an install hook to remove them.
tmplibdir = $(libdir)/tmp
install-data-hook:
$(RM) -r $(DESTDIR)$(tmplibdir)
#include "cltally.h"
#include "tally.h"
#include <stdlib.h> // calloc
#include <stdio.h> // printf
#include <string.h> // strcmp
bt_component_class_sink_consume_method_status cltally_dispatch_consume(
bt_component_class_sink_consume_method_status tally_dispatch_consume(
bt_self_component_sink *self_component_sink)
{
bt_component_class_sink_consume_method_status status =
BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
/* Retrieve our private data from the component's user data */
struct cltally_dispatch *dispatch = bt_self_component_get_data(
struct tally_dispatch *dispatch = (tally_dispatch*) bt_self_component_get_data(
bt_self_component_sink_as_self_component(self_component_sink));
/* Consume a batch of messages from the upstream message iterator */
......@@ -45,10 +45,18 @@ bt_component_class_sink_consume_method_status cltally_dispatch_consume(
const bt_event *event = bt_message_event_borrow_event_const(message);
const bt_event_class *event_class = bt_event_borrow_class_const(event);
const char * class_name = bt_event_class_get_name(event_class);
if (strcmp(class_name,"lttng:host") ) {
printf("host\n");
} else if ( strcmp(class_name,"lttng:device") ) {
// I should compare type. Not somme string.
//const hostname_t hostname = borrow_hostname(bt_evt);
//const process_id_t process_id = borrow_process_id(bt_evt);
//const thread_id_t thread_id = borrow_thread_id(bt_evt);
if (strcmp(class_name,"lttng:host") == 0 ) {
printf("%s, host\n",class_name);
//dispatch->tally_host[hpt_function_name_t(hostname,process_id, thread_id, event_name)].delta(duration, error);
} else if ( strcmp(class_name,"lttng:device") == 0 ) {
printf("device\n");
//dispatch->tally_device[hpt_function_name_t(hostname,process_id, thread_id, device, subdevice, function_name)].delta(duration, error);
}
}
......@@ -61,13 +69,13 @@ end:
/*
* Initializes the sink component.
*/
bt_component_class_initialize_method_status cltally_dispatch_initialize(
bt_component_class_initialize_method_status tally_dispatch_initialize(
bt_self_component_sink *self_component_sink,
bt_self_component_sink_configuration *configuration,
const bt_value *params, void *initialize_method_data)
{
/* Allocate a private data structure */
struct cltally_dispatch *dispatch = calloc(1, sizeof(struct cltally_dispatch));
struct tally_dispatch *dispatch = (tally_dispatch*) calloc(1, sizeof(struct tally_dispatch));
/* Set the component's user data to our private data structure */
bt_self_component_set_data(
......@@ -95,10 +103,10 @@ bt_component_class_initialize_method_status cltally_dispatch_initialize(
* This is where we can create our upstream message iterator.
*/
bt_component_class_sink_graph_is_configured_method_status
cltally_dispatch_graph_is_configured(bt_self_component_sink *self_component_sink)
tally_dispatch_graph_is_configured(bt_self_component_sink *self_component_sink)
{
/* Retrieve our private data from the component's user data */
struct cltally_dispatch *dispatch = bt_self_component_get_data(
struct tally_dispatch *dispatch = (tally_dispatch*) bt_self_component_get_data(
bt_self_component_sink_as_self_component(self_component_sink));
/* Borrow our unique port */
......
......@@ -7,23 +7,23 @@ extern "C" {
#endif
/* Sink component's private data */
struct cltally_dispatch {
struct tally_dispatch {
bt_message_iterator *message_iterator;
};
bt_component_class_sink_consume_method_status cltally_dispatch_consume(
bt_component_class_sink_consume_method_status tally_dispatch_consume(
bt_self_component_sink *self_component_sink);
bt_component_class_initialize_method_status cltally_dispatch_initialize(
bt_component_class_initialize_method_status tally_dispatch_initialize(
bt_self_component_sink *self_component_sink,
bt_self_component_sink_configuration *configuration,
const bt_value *params, void *initialize_method_data);
void cltally_dispatch_finalize(bt_self_component_sink *self_component_sink);
void tally_dispatch_finalize(bt_self_component_sink *self_component_sink);
bt_component_class_sink_graph_is_configured_method_status
cltally_dispatch_graph_is_configured(bt_self_component_sink *self_component_sink);
tally_dispatch_graph_is_configured(bt_self_component_sink *self_component_sink);
#ifdef __cplusplus
}
......
#include <babeltrace2/babeltrace.h>
#include "tally.h"
/* Mandatory */
BT_PLUGIN_MODULE();
/* Define the `clprof` plugin */
BT_PLUGIN(xprof);
//~ ~ ~
// Sink Tally
//~ ~ ~
BT_PLUGIN_SINK_COMPONENT_CLASS(tally, tally_dispatch_consume);
BT_PLUGIN_SINK_COMPONENT_CLASS_INITIALIZE_METHOD(tally, tally_dispatch_initialize);
//BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD(tally, cltally_dispatch_finalize);
BT_PLUGIN_SINK_COMPONENT_CLASS_GRAPH_IS_CONFIGURED_METHOD(tally, tally_dispatch_graph_is_configured);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment