Macro Definition

  • PROF: encapsulates profiling statements. Use the ENABLE_PROF macro to determine whether to profile data during compilation. One or two parameters can be passed.
    • One parameter: profiling statement.

      If ENABLE_PROF is defined, the system runs print function. If it is not defined, printing is skipped.

      PROF(std::cout<< "enable prof" << std::endl);

    • Two parameters: profiling level and profiling statement. The class to be profiled is automatically initialized and the profile level is defined.

      If ENABLE_PROF is defined, the system runs profiling. If it is not defined, profiling is skipped and the profiler class is automatically initialized.

      PROF(INFO, Attr("req", 1).Event("recv"));

  • ENABLE_PROF: works with PROF. If this environment variable is not defined, profiling is disabled, and PROF is automatically defined as empty. It is usually defined in the CMakeLists.txt file.

    add_definitions(-DENABLE_PROF)