Commit 9129597e authored by Thomas Applencourt's avatar Thomas Applencourt
Browse files

Use hpp file for clarity

parent 70e27c8f
......@@ -117,16 +117,14 @@ clinterval_callbacks.cpp: $(srcdir)/clinterval_callbacks.cpp.erb $(srcdir)/gen_c
nodist_libCLProf_la_SOURCES = \
clinterval_callbacks.cpp \
clinterval_dispatchers.c \
clinterval_callbacks.h \
tracer_opencl.h
libCLProf_la_SOURCES = \
clprof.c \
clinterval.h \
clinterval.c \
clinterval_helpers.h \
clinterval_callbacks_state.h
clinterval_callbacks.hpp
libCLProf_la_CPPFLAGS = -I$(top_srcdir)/utils -I$(srcdir)/include -I./
libCLProf_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
libCLProf_la_CXXFLAGS = -std=c++17 -Wall -Wextra -Wno-unused-parameter -Werror $(BABELTRACE2_CFLAGS)
......
#ifndef _CLINTERVAL_H
#define _CLINTERVAL_H
#pragma once
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <stdbool.h>
#include <babeltrace2/babeltrace.h>
#include "uthash.h"
#include "utarray.h"
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
......@@ -68,6 +66,20 @@ struct clinterval_message_iterator {
};
// To talk to the callbacks
extern void init_clinterval_callbacks(struct clinterval_dispatch*);
extern void* init_clinterval_callbacks_state();
bool downstream_message_queue_empty(struct clinterval_message_iterator*);
size_t downstream_message_queue_size(struct clinterval_message_iterator*);
const bt_message * downstream_message_queue_pop(struct clinterval_message_iterator*);
// Global state for the downstream message
extern struct clinterval_message_iterator *clinterval_iter_g;
extern bt_self_message_iterator *self_message_iterator_g;
extern
bt_component_class_initialize_method_status clinterval_dispatch_initialize(
bt_self_component_filter *self_component_filter,
......@@ -105,12 +117,7 @@ extern
void clinterval_dispatch_message_iterator_finalize(
bt_self_message_iterator *self_message_iterator);
// Global state for the downstream message
extern struct clinterval_message_iterator *clinterval_iter_g;
extern bt_self_message_iterator *self_message_iterator_g;
#ifdef __cplusplus
}
#endif
#endif
......@@ -4,11 +4,23 @@
#include <unordered_map>
#include <tuple>
#include <climits>
#include "clinterval.h" // For self_message_iterator_g
#include "clinterval_callbacks.h"
#include "clinterval_helpers.h"
#include "clinterval_callbacks_state.h"
#include "xprof_utils.h"
#include "clinterval.h"
#include "clinterval_callbacks.hpp"
#include "xprof_utils.hpp"
#include <babeltrace2/babeltrace.h>
#define CL_TARGET_OPENCL_VERSION 300
#define CL_USE_DEPRECATED_OPENCL_1_0_APIS
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#define CL_USE_DEPRECATED_OPENCL_2_0_APIS
#define CL_USE_DEPRECATED_OPENCL_2_1_APIS
#define CL_USE_DEPRECATED_OPENCL_2_2_APIS
#include <CL/opencl.h>
#include <CL/cl_gl_ext.h>
#include <CL/cl_egl.h>
#include <CL/cl_ext_intel.h>
#include "tracer_opencl.h"
void *init_clinterval_callbacks_state() {
clinterval_callbacks_state *s = new clinterval_callbacks_state;
......
#ifndef CLINTERVAL_CALLBACKS_STATE_H
#define CLINTERVAL_CALLBACKS_STATE_H
#pragma once
#include "xprof_utils.h"
#include "xprof_utils.hpp"
#include <queue>
#include <babeltrace2/babeltrace.h>
#include <unordered_map>
#define CL_TARGET_OPENCL_VERSION 300
#include <CL/opencl.h>
typedef std::tuple<hostname_t, process_id_t, cl_command_queue> hp_command_queue_t;
typedef std::tuple<hostname_t, process_id_t, cl_event> hp_event_t;
......@@ -30,4 +31,3 @@ struct clinterval_callbacks_state {
std::queue<const bt_message*> downstream_message_queue;
};
#endif
#ifndef CLINTERVAL_HELPERS_H
#define CLINTERVAL_HELPERS_H
#include "clinterval.h"
#ifdef __cplusplus
extern "C" {
#endif
extern void init_clinterval_callbacks(struct clinterval_dispatch*);
extern void* init_clinterval_callbacks_state();
bool downstream_message_queue_empty(struct clinterval_message_iterator*);
size_t downstream_message_queue_size(struct clinterval_message_iterator*);
const bt_message * downstream_message_queue_pop(struct clinterval_message_iterator*);
#ifdef __cplusplus
}
#endif
#endif
......@@ -12,23 +12,23 @@ iprof: $(top_builddir)/utils/xprof.sh.erb
chmod a+x $@
tally_utils.h: tally_utils.h.erb
SRC_DIR=$(srcdir) ${ERB} $(srcdir)/tally_utils.h.erb > $@
tally_utils.hpp: tally_utils.hpp.erb
SRC_DIR=$(srcdir) ${ERB} $(srcdir)/tally_utils.hpp.erb > $@
# Library to be packaged
lib_LTLIBRARIES = libXProf.la
# File to compiled
nodist_libXProf_la_SOURCES = \
tally_utils.h
tally_utils.hpp
# File to compiled
libXProf_la_SOURCES = \
xprof.c \
tally_state.h \
tally.hpp \
tally.h \
tally.cpp \
timeline_state.h \
timeline.hpp \
timeline.h \
timeline.cpp
......@@ -48,7 +48,7 @@ install-data-hook:
$(RM) -r $(DESTDIR)$(tmplibdir)
EXTRA_DIST = \
tally_utils.h.erb
tally_utils.hpp.erb
CLEANFILES = \
tally_utils.h
tally_utils.hpp
#include "tally.h"
#include "xprof_utils.h" //Typedef and hashtuple
#include "tally_utils.h"
#include "tally_state.h"
#include "tally.hpp"
#include "xprof_utils.hpp" //Typedef and hashtuple
#include "tally_utils.hpp"
#include <string.h> // strcmp
bt_component_class_sink_consume_method_status tally_dispatch_consume(
......
#pragma once
#include "xprof_utils.h"
#include "tally_utils.h"
#include "xprof_utils.hpp"
#include "tally_utils.hpp"
/* Sink component's private data */
struct tally_dispatch {
......
......@@ -9,7 +9,7 @@
#include <algorithm>
#include <set>
#include "xprof_utils.h"
#include "xprof_utils.hpp"
template <typename T>
std::string to_string_with_precision(const T a_value, const std::string extension, const int n = 2)
......
#include "timeline.h"
#include "timeline_state.h"
#include "xprof_utils.h" // typedef
#include "timeline.hpp"
#include "xprof_utils.hpp" // typedef
#include <iomanip> // set precision
#include <iostream> // stdcout
#include <stdio.h> // printf
#include <string.h> // strcmp
bt_component_class_sink_consume_method_status timeline_dispatch_consume(
bt_self_component_sink *self_component_sink)
......
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