The code will be cleaner with only the Trace call without any ifdef mess.
Easy to change the trace profilier by changing the trace backend.
if disabled won't add any code to efl.
Change-Id: I2b8a1d00f8470b904703c23ffd17aac0ab3eeaaf
subdir('header_checks')
subdir('po')
+subdir('tracing')
if get_option('wl') == true
subdir(join_paths('src', 'wayland_protocol'))
type: 'boolean',
value: false,
description: 'tbm engine'
+)
+
+option('trace',
+ type : 'combo',
+ choices : ['ttrace', 'vtune', 'none'],
+ value : 'none',
+ description : 'Support Tracing in Efl'
)
\ No newline at end of file
#include "ecore_private.h"
+#include "efl_tracing.h"
+
#ifndef O_BINARY
# define O_BINARY 0
#endif
int x, int y, int w, int h, Eina_Bool frame)
{
//TIZEN_ONLY(20160628): Add Performance log for cold booting
-#ifdef ENABLE_TTRACE
- traceBegin(TTRACE_TAG_EFL, "ecore_evas_wayland_shm_new");
-#endif
+ traceTaskStart("ecore_evas_wayland_shm_new");
//
Ecore_Evas *ee;
Ecore_Evas *(*new)(const char *, Ecore_Window, int, int, int, int, Eina_Bool);
Eina_Module *m = _ecore_evas_engine_load("wayland");
//TIZEN_ONLY(20160628): Add Performance log for cold booting
-#ifdef ENABLE_TTRACE
- if (!m) traceEnd(TTRACE_TAG_EFL);
-#endif
+ if (!m) traceTaskEnd();
//
EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL);
new = eina_module_symbol_get(m, "ecore_evas_wayland_shm_new_internal");
//TIZEN_ONLY(20160628): Add Performance log for cold booting
-#ifdef ENABLE_TTRACE
- if (!new) traceEnd(TTRACE_TAG_EFL);
-#endif
+ if (!new) traceTaskEnd();
//
EINA_SAFETY_ON_NULL_RETURN_VAL(new, NULL);
return NULL;
}
//TIZEN_ONLY(20160628): Add Performance log for cold booting
-#ifdef ENABLE_TTRACE
- traceEnd(TTRACE_TAG_EFL);
-#endif
+ traceTaskEnd();
//
return ee;
}
#endif
#define CRI(...) EINA_LOG_DOM_CRIT(_ecore_evas_log_dom, __VA_ARGS__)
-#ifdef ENABLE_TTRACE
-#include <ttrace.h>
-#endif
-
#define PORTRAIT_CHECK(r) \
((r == 0) || (r == 180))
#include "edje_private.h"
+#include "efl_tracing.h"
+
Eina_Hash *_edje_file_hash = NULL;
static int _edje_file_cache_size = 16;
id = ce->id;
if (id < 0) return NULL;
+ traceTaskDataStart("edje_coll_open", coll);
+
edje_cache_emp_alloc(ce);
snprintf(buf, sizeof(buf), "edje/collections/%i", id);
edc = eet_data_read(edf->ef, _edje_edd_edje_part_collection, buf);
EDJE_LOAD_BUILD_TABLE(nocmp, edc, i, pr);
}
}
-
+ traceTaskEnd();
return edc;
}
void *mapping;
size_t mapping_size;
+ traceTaskDataStart("edje_file_open", eina_file_filename_get(f));
+
ef = eet_mmap(f);
if (!ef)
{
if (sc->name)
eina_hash_direct_add(edf->size_hash, sc->name, sc);
+ traceTaskEnd();
return edf;
}
#include "edje_private.h"
+#include "efl_tracing.h"
+
static void _edje_message_propagate_send(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, void *emsg, Eina_Bool prop);
static int _injob = 0;
Evas_Object *o;
if (ed->delete_me) return;
+
+ traceTaskStart("edje_signal_process");
+
_edje_object_message_signal_process_do(obj, ed);
- if (!recurse) return;
+ if (!recurse)
+ {
+ traceTaskEnd();
+ return;
+ }
EINA_LIST_FOREACH(ed->subobjs, l, o)
efl_layout_signal_process(o, EINA_TRUE);
+
+ traceTaskEnd();
}
static Eina_Bool
#include "eina_evlog.h"
#include "eina_debug.h"
-// TIZEN_ONLY(20160401): TTRACE
-#ifdef ENABLE_TTRACE
-#include <ttrace.h>
-#endif
-// TIZEN_ONLY(20160401): TTRACE
+#include "efl_tracing.h"
#if defined(__APPLE__) && defined(__MACH__)
# include <mach/mach_time.h>
unsigned short detail_offset, event_size;
// TIZEN_ONLY(20160401): TTRACE
-#ifdef ENABLE_TTRACE
+#ifdef TTRACE_PROFILER
#ifndef TIZEN_PROFILE_TV
if(!strncmp(event, "+", 1))
traceBegin(TTRACE_TAG_GRAPHICS, event + 1);
eina_deps = [dl]
+eina_deps += tracing_deps
eina_pub_deps = [thread_dep]
if sys_windows == true
#include <EMap.h>
#endif
-#ifdef ENABLE_TTRACE
-#include <ttrace.h>
-#endif
-
#ifdef EAPI
# undef EAPI
#endif
#include <Elementary.h>
#include <Elementary_Cursor.h>
+#include "efl_tracing.h"
+
#include "elm_priv.h"
#include "elm_widget_menu.h"
#ifdef HAVE_ELEMENTARY_WL2
void
_elm_win_standard_init(Eo *obj)
{
+ traceTaskStart("win_standard_init");
+
/* Support for elm_util_win_standard_add() and Efl.Ui.Win.Standard */
Efl_Ui_Win_Data *sd = efl_data_scope_get(obj, MY_CLASS);
}
_elm_win_frame_style_update(sd, 0, 1);
+
+ traceTaskEnd();
}
static Eina_Bool
elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
{
//TIZEN_ONLY(20160628): Add Performance log for cold booting
-#ifdef ENABLE_TTRACE
- traceBegin(TTRACE_TAG_EFL, "elm_win_add");
-#endif
+ traceTaskStart("elm_win_add");
//
const Efl_Class *klass = EFL_UI_WIN_LEGACY_CLASS;
else
efl_canvas_object_paragraph_direction_set(tmp, EVAS_BIDI_DIRECTION_LTR);
/* END */
-
+ traceTaskEnd();
return tmp;
}
}
efl_ui_win_type_set(efl_added, type));
//TIZEN_ONLY(20160628): Add Performance log for cold booting
-#ifdef ENABLE_TTRACE
- traceEnd(TTRACE_TAG_EFL);
-#endif
+ traceTaskEnd();
//
return obj;
}
{
Evas_Object *win;
+ traceTaskStart("win_standard_add");
+
// TIZEN_ONLY(20180518): apply precreated window
win = elm_win_add(NULL, name, ELM_WIN_BASIC);
if (!win) return NULL;
*//////
_elm_win_standard_init(win);
+
+ traceTaskEnd();
+
return win;
}
#include <Elementary.h>
+#include "efl_tracing.h"
+
#include "eina_internal.h"
#include "ecore_internal.h"
EAPI int
elm_init(int argc, char **argv)
{
-//TIZEN_ONLY(20160628): Add Performance log for cold booting
-#ifdef ENABLE_TTRACE
- traceBegin(TTRACE_TAG_EFL, "elm_init");
-#endif
- //
_elm_init_count++;
if (_elm_init_count > 1)
{
-//TIZEN_ONLY(20160628): Add Performance log for cold booting
-#ifdef ENABLE_TTRACE
- traceEnd(TTRACE_TAG_EFL);
-#endif
- //
return _elm_init_count;
}
+ //TIZEN_ONLY(20160628): Add Performance log for cold booting
+ traceTaskStart("elm_init");
+ //
EINA_SAFETY_ON_FALSE_RETURN_VAL(elm_quicklaunch_init(argc, argv ? argv : (char**) bcargv), --_elm_init_count);
EINA_SAFETY_ON_FALSE_GOTO(elm_quicklaunch_sub_init(argc, argv ? argv : (char**) bcargv), shutdown_ql);
_elm_startup_time = _efl_startup_time;
_efl_ui_theme_apply_error_init();
-//TIZEN_ONLY(20160628): Add Performance log for cold booting
-#ifdef ENABLE_TTRACE
- traceEnd(TTRACE_TAG_EFL);
-#endif
+ //TIZEN_ONLY(20160628): Add Performance log for cold booting
+ traceTaskEnd();
//
+
return _elm_init_count;
shutdown_ql:
elm_quicklaunch_shutdown();
{
_elm_ql_init_count++;
if (_elm_ql_init_count > 1) return _elm_ql_init_count;
+
+ traceTaskStart("elm_quicklaunch_init");
+
_use_build_config = !!getenv("EFL_RUN_IN_TREE");
EINA_SAFETY_ON_FALSE_GOTO(eina_init(), fail_eina);
_elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
eina_log_timing(_elm_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT);
+ traceTaskEnd();
+
if (quicklaunch_on)
_elm_init_count++;
return _elm_ql_init_count;
{
_elm_sub_init_count++;
if (_elm_sub_init_count > 1) return _elm_sub_init_count;
+
+ traceTaskStart("elm_quicklaunch_sub_init");
+
_elm_config_init();
if (!quicklaunch_on)
_elm_prefs_initted = _elm_prefs_init();
EINA_SAFETY_ON_FALSE_GOTO(_elm_ews_wm_init(), ql_sub_ews);;
}
+
+ traceTaskEnd();
+
return _elm_sub_init_count;
ql_sub_ews:
if (_elm_prefs_initted) _elm_prefs_shutdown();
#include "evas_font.h"
+#include "efl_tracing.h"
+
/* General types - used for script type chceking */
#define OPAQUE_TYPE(type) struct __##type { int a; }; \
typedef struct __##type type
Eina_List *l;
char *path;
+ traceTaskStart("font_config_init");
+
fc_config = FcInitLoadConfigAndFonts();
EINA_LIST_FOREACH(global_font_path, l, path)
FcConfigAppFontAddDir(fc_config, (const FcChar8 *) path);
+
+ traceTaskEnd();
}
#endif
}
}
}
+ traceTaskDataStart("font_load", fdesc->name);
+
#ifdef HAVE_FONTCONFIG
if (found_fd)
{
if (font)
evas_common_font_hinting_set((RGBA_Font *)font, hinting);
+
+ traceTaskEnd();
+
return font;
}
//#define REND_DBG 1
#define STDOUT_DBG
+#include "efl_tracing.h"
+
#ifdef REND_DBG
static FILE *dbf = NULL;
static int __RD_level = 0;
double start_time = _time_get();
#endif
+ traceFrameStart();
+
evas_render_pre(eo_e, evas);
_evas_planes(e);
e->inside_post_render = EINA_FALSE;
eina_spinlock_release(&(e->render.lock));
if (post.updated_area) eina_list_free(post.updated_area);
+
+ traceFrameEnd();
}
RD(0, "---]\n");
#ifdef EVAS_RENDER_DEBUG_TIMING
_accumulate_time(0, EINA_TRUE);
#endif
+
+ traceFrameEnd();
}
static void
--- /dev/null
+#pragma once
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#else
+# define EINA_UNUSED
+#endif
+
+#ifdef TTRACE_PROFILER
+
+#include <ttrace.h>
+
+static inline void _ttrace_append_domain(const char *name, const char *data)
+{
+ char buf[500];
+
+ if (data)
+ {
+ sprintf(buf,"%s::%s", name,data);
+ traceBegin(TTRACE_TAG_EFL, buf);
+ }
+ else
+ traceBegin(TTRACE_TAG_EFL, name);
+}
+
+#define traceFrameStart() traceBegin(TTRACE_TAG_EFL, "Frame")
+
+#define traceFrameEnd() traceEnd(TTRACE_TAG_EFL)
+
+#define traceTaskDataStart(name, data) _ttrace_append_domain(name, data)
+
+#define traceTaskStart(name) traceBegin(TTRACE_TAG_EFL, name);
+
+#define traceTaskEnd() traceEnd(TTRACE_TAG_EFL);
+
+#elif VTUNE_PROFILER
+
+#include <ittnotify.h>
+
+static __itt_domain* _vtune_efl_domain = NULL;
+
+static inline void _vtune_task_start(const char *name)
+{
+ if (!_vtune_efl_domain) _vtune_efl_domain = __itt_domain_create("EFL");
+
+ __itt_task_begin(_vtune_efl_domain, __itt_null, __itt_null,
+ __itt_string_handle_create(name));
+}
+
+static inline void _vtune_append_domain(const char *name, const char *data)
+{
+ char buf[500];
+
+ if (!_vtune_efl_domain) _vtune_efl_domain = __itt_domain_create("EFL");
+
+ if (data)
+ sprintf(buf,"%s::%s", name,data);
+ else
+ sprintf(buf,"%s", name);
+
+ __itt_task_begin(_vtune_efl_domain, __itt_null, __itt_null,
+ __itt_string_handle_create(buf));
+}
+
+static inline void _vtune_frame_start()
+{
+ if (!_vtune_efl_domain) _vtune_efl_domain = __itt_domain_create("EFL");
+
+ __itt_frame_begin_v3(_vtune_efl_domain, NULL);
+}
+
+#define traceFrameStart() _vtune_frame_start();
+
+#define traceFrameEnd() __itt_frame_end_v3(_vtune_efl_domain, NULL)
+
+#define traceTaskDataStart(name, data) _vtune_append_domain(name, data)
+
+#define traceTaskStart(name) _vtune_task_start(name)
+
+#define traceTaskEnd() __itt_task_end(_vtune_efl_domain)
+
+#else
+
+#define traceTaskDataStart(name, data)
+
+#define traceTaskStart(name)
+
+#define traceTaskEnd()
+
+#define traceFrameStart()
+
+#define traceFrameEnd()
+
+#endif
\ No newline at end of file
--- /dev/null
+config_dir += include_directories('.')
+
+tracing_deps = []
+
+if (get_option('trace') == 'ttrace')
+ config_h.set10('TTRACE_PROFILER', true)
+ tracing_deps = dependency('ttrace')
+elif (get_option('trace') == 'vtune')
+ config_h.set10('VTUNE_PROFILER', true)
+ vtune_dep = dependency('ittnotify' , required:false)
+ if (vtune_dep.found())
+ tracing_deps += vtune_dep
+ else
+ cc = meson.get_compiler('cpp')
+ lib_itt = cc.find_library('ittnotify',
+ dirs : ['/opt/intel/system_studio_2019/vtune_amplifier_2019/lib64/'])
+ lib_itt_dep = declare_dependency (
+ include_directories : include_directories('/opt/intel/system_studio_2019/vtune_amplifier_2019/include'),
+ dependencies: lib_itt
+ )
+ tracing_deps += lib_itt_dep
+ endif
+endif