1# A minimalistic profiler sampling pseudo-stacks 2 3load("//ruy:build_defs.oss.bzl", "ruy_linkopts_thread_standard_library") 4 5package( 6 licenses = ["notice"], # Apache 2.0 7) 8 9config_setting( 10 name = "ruy_profiler", 11 define_values = {"ruy_profiler": "true"}, 12) 13 14# Used to build TFLite Micro RUY dependency for embedded targets outside of the 15# RUY source tree. 16filegroup( 17 name = "ruy_instrumentation_header", 18 srcs = ["instrumentation.h"], 19 visibility = ["//visibility:public"], 20) 21 22cc_library( 23 name = "instrumentation", 24 srcs = ["instrumentation.cc"], 25 hdrs = ["instrumentation.h"], 26 defines = select({ 27 ":ruy_profiler": ["RUY_PROFILER"], 28 "//conditions:default": [], 29 }), 30 linkopts = ruy_linkopts_thread_standard_library(), 31 visibility = ["//visibility:public"], 32) 33 34cc_library( 35 name = "profiler", 36 srcs = [ 37 "profiler.cc", 38 "treeview.cc", 39 ], 40 hdrs = [ 41 "profiler.h", 42 "treeview.h", 43 ], 44 linkopts = ruy_linkopts_thread_standard_library(), 45 visibility = ["//visibility:public"], 46 deps = [":instrumentation"], 47) 48 49cc_library( 50 name = "test_instrumented_library", 51 testonly = True, 52 srcs = ["test_instrumented_library.cc"], 53 hdrs = ["test_instrumented_library.h"], 54 deps = [":instrumentation"], 55) 56 57cc_test( 58 name = "test", 59 srcs = ["test.cc"], 60 linkopts = ruy_linkopts_thread_standard_library(), 61 deps = [ 62 ":profiler", 63 ":test_instrumented_library", 64 "//ruy:gtest_wrapper", 65 ], 66) 67