Coverage Summary for Class: Profiler (co.rsk.metrics.profilers)

Class Method, % Line, %
Profiler$PROFILING_TYPE 100% (2/2) 100% (23/23)
Total 100% (2/2) 100% (23/23)


1 package co.rsk.metrics.profilers; 2  3  4 /** 5  * Interface every profiler has to implement. The profiler is responsible of the profiling logic. 6  * Different profilers may take completely different measurements or use different approaches 7  */ 8 public interface Profiler { 9  10  /** 11  *List of possible measurement categories (or types). 12  * Depending on what is actually being profiled, new categories can be added or 13  * categories not needed can be removed 14  */ 15  enum PROFILING_TYPE { 16  // BLOCK_CONNECTION - BLOCK_EXECUTE = Time consumed fetching the block and, after block execution, saving the data 17  // that means some DB_READ and DB_WRITE will be included here (and contained in the DB_READ and DB_WRITE categories again) 18  BLOCK_CONNECTION, 19  BLOCK_EXECUTE, 20  PRECOMPILED_CONTRACT_INIT, 21  PRECOMPILED_CONTRACT_EXECUTE, 22  VM_EXECUTE, 23  BLOCK_VALIDATION, //Note some validators call TRIE_GET_HASH 24  BLOCK_TXS_VALIDATION, //Note that it internally calls KEY_RECOV_FROM_SIG 25  BLOCK_FINAL_STATE_VALIDATION, 26  KEY_RECOV_FROM_SIG, 27  DB_READ, 28  DB_WRITE, 29  FILLING_EXECUTED_BLOCK, 30  LEVEL_DB_INIT, 31  LEVEL_DB_CLOSE, 32  LEVEL_DB_DESTROY, 33  TRIE_GET_VALUE_FROM_KEY, 34  BEFORE_BLOCK_EXEC, 35  AFTER_BLOCK_EXEC, 36  BUILD_TRIE_FROM_MSG, 37  TRIE_TO_MESSAGE, //Currently inactive, to measure, add the hooks in Trie::toMessage() and Trie::toMessageOrchid() 38  TRIE_CONVERTER_GET_ACCOUNT_ROOT, 39  BLOCKCHAIN_FLUSH 40  } 41  42  43  /** 44  * Starts a metric of a specific type 45  * @param type task category that needs to be profiled 46  * @return new Metric instance 47  */ 48  Metric start(PROFILING_TYPE type); 49  50  /** 51  * Stops a metric finalizing all the properties being profiled 52  * @param metric Metric instance that needs to be finalized 53  */ 54  void stop(Metric metric); 55 }