Project
Loading...
Searching...
No Matches
test_Signpost.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include "Framework/Signpost.h"
13#include <iostream>
14
15int main(int argc, char** argv)
16{
17 O2_DECLARE_LOG(test_Signpost, "my category");
18 O2_DECLARE_DYNAMIC_LOG(test_SignpostDynamic);
19
20 std::cout << "Loggers: " << std::endl;
21 o2_walk_logs([](char const* name, void* log, void*) -> bool {
22 std::cout << " - name: " << name << " " << log << std::endl;
23 return true;
24 },
25 nullptr);
26
27 O2_LOG_DEBUG(test_Signpost, "%s %d", "test_Signpost", 1);
28 O2_SIGNPOST_ID_GENERATE(id, test_Signpost);
29 O2_SIGNPOST_ID_GENERATE(id2, test_Signpost);
30 O2_SIGNPOST_START(test_Signpost, id, "Test category", "This is a test signpost");
31 O2_SIGNPOST_START(test_Signpost, id2, "Test category", "A sepaarate interval");
32 O2_SIGNPOST_EVENT_EMIT(test_Signpost, id, "Test category", "An event in an interval");
33 O2_SIGNPOST_END(test_Signpost, id, "Test category", "End of the first interval");
34 O2_SIGNPOST_END(test_Signpost, id2, "Test category", "A sepaarate interval");
35 O2_SIGNPOST_ID_FROM_POINTER(id3, test_Signpost, &id2);
36 O2_SIGNPOST_START(test_Signpost, id3, "Test category", "A signpost interval from a pointer");
37 O2_SIGNPOST_END(test_Signpost, id3, "Test category", "A signpost interval from a pointer");
38
39 // This has an engineering type, which we will not use on Linux / FairLogger
40 O2_SIGNPOST_ID_FROM_POINTER(id4, test_Signpost, &id3);
41 O2_SIGNPOST_START(test_Signpost, id4, "Test category", "A signpost with an engineering type formatter %{size-in-bytes}d", 1);
42 O2_SIGNPOST_END(test_Signpost, id4, "Test category", "A signpost interval from a pointer");
43
44 O2_SIGNPOST_START(test_SignpostDynamic, id, "Test category", "This is dynamic signpost which you will not see, because they are off by default");
45 O2_SIGNPOST_END(test_SignpostDynamic, id, "Test category", "This is dynamic signpost which you will not see, because they are off by default");
46 O2_LOG_ENABLE(test_SignpostDynamic);
47#ifdef __APPLE__
48 // On Apple there is no way to turn on signposts in the logger, so we do not display this message
49 O2_SIGNPOST_START(test_SignpostDynamic, id, "Test category", "This is dynamic signpost which you will see, because we turned them on");
50 O2_SIGNPOST_END(test_SignpostDynamic, id, "Test category", "This is dynamic signpost which you will see, because we turned them on");
51#endif
52}
#define O2_LOG_DEBUG(log,...)
Definition Signpost.h:482
o2_log_handle_t * o2_walk_logs(bool(*callback)(char const *name, void *log, void *context), void *context=nullptr)
#define O2_DECLARE_DYNAMIC_LOG(name)
Definition Signpost.h:473
#define O2_SIGNPOST_ID_FROM_POINTER(name, log, pointer)
Definition Signpost.h:489
#define O2_SIGNPOST_END(log, id, name, format,...)
Definition Signpost.h:540
#define O2_SIGNPOST_ID_GENERATE(name, log)
Definition Signpost.h:490
#define O2_DECLARE_LOG(name, category)
Definition Signpost.h:476
#define O2_LOG_ENABLE(log)
Definition Signpost.h:478
#define O2_SIGNPOST_EVENT_EMIT(log, id, name, format,...)
Definition Signpost.h:495
#define O2_SIGNPOST_START(log, id, name, format,...)
Definition Signpost.h:534
GLuint const GLchar * name
Definition glcorearb.h:781
#define main