Skip to content
Dmitry Romanov edited this page Jun 28, 2017 · 15 revisions

C++ Overview

 +------------------+      +------------------+
 |   User C++ API   |  --  |     JANA API     |
 +------------------+      +------------------+
           |
+---------------------+
|  Under the hood API |
+---------------------+

CCDB C++ library consists of separate levels (see fig. \ref{pic:cpp_api_levels}).

  • C++ User API - This level is most probably what any user, who is not bound to JANA, needs. The API provides simple functionality to get constants. It automates connections number, multi-threading, data source selection, etc.

  • JANA API - This level integrates CCDB and JANA framework. JANA API is now shipped with JANA framework. Architecturally it is based on Users C++ API.

  • Under the hood API - This level considered to be internal and could be interesting only in terms further development of CCDB. Regular users should not use classes from this level

    Low level API is subject to change for better CCDB performance and stability. Changes are done without any remorse to any user code which that uses the API.

    That is the reason why Low level API should be kept separated and used only in CCDB higher levels.

Performance profiling

CCDB may be build with performance profiling flag. Then, the outputs of running CCDB may be analyzed with $CCDB_HOME/python/ccdb_cpp_perf.py

It allows to evaluate performance and befaviour of C++ CCDB API on working applications

One has to compile CCDB C++ API with with-perflog=true (it defines CCDB_PERFLOG_ON in C++):

> cd $CCDB_HOME
> scons with-perflog=true

With this flag, whenever any constant is requested, CCDB spams performance info to std::cout. Example of one record:

CCDB_PERF_LOG:{"thread_id":139771280078592,"descr":"Calibration::GetAssignment=>/PHOTON_BEAM/endpoint_energy","start_stamp":1498647171590502,"elapsed":1558,"t_units":"us"}

One needs to save all the outputs to a file and provide a path to the file to ccdb_cpp_perf.py

So after CCDB is compiled using with-perflog=true, the commands are:

> <analysing_soft> ... > ccdb_perf.log
> python $CCDB_HOME/python/ccdb_cpp_perf.py ccdb_cpp_perf

Troubleshouting

If you don't see CCDB_PERF_LOG:... messages and you are sure that ccdb is called at all, check with 'ldd' that the right copy of ccdb.so is loaded.