( stop_watch_sz ) {
24 for(
size_tsw_ndx = 0; sw_ndx < stop_watch_sz; ++sw_ndx ){
31 if( sw_ndx <
m_sw_vec.size() )
return;
33 for(
size_tsw_item_ndx =
m_sw_vec.size(); sw_item_ndx < sw_ndx; ++sw_item_ndx ){
38std::map< std::string,CStopWatch >::iterator it =
m_sw_map.find( sw_name );
39 if( it !=
m_sw_map.end() )
return;
48std::map< std::string,CStopWatch >::iterator it =
m_sw_map.find( sw_name );
63 if( sw_ndx >
m_sw_vec.size() )
return;
67std::map< std::string,CStopWatch >::iterator it =
m_sw_map.find( sw_name );
68 if( it ==
m_sw_map.end() )
return;
107 m_user_data.push_back( std::make_pair( key_name, key_val) );
111 return m_sw_vec[ sw_ndx ].AsString (fmt);
115std::map< std::string,CStopWatch >::const_iterator it =
m_sw_map.find( sw_name );
116 if( it ==
m_sw_map.end() )
return string(
"BAD_NAME:") + sw_name;
117 return m_sw_map[ sw_name ].AsString (fmt);
141 m_markers.push_back( std::make_pair ( new_marker, new_time_str ) );
152 stringprofile_log =
"blastapi_profile.csv";
153 char*env_ptr = getenv(
"BLASTAPI_PROFILE_LOG");
154 if( env_ptr ==
NULL)
return false;
156report_name = profile_log;
158profile_log =
string( env_ptr ) ;
165std::ofstream log_ofs;
170 if(log_ofs.fail()) {
171cerr <<
"Can't log profile data to the \""<< report_name<<
"\" errno: " 176std::map< std::string,CStopWatch >::iterator item_itr;
179std::list< std::pair< std::string, std::string >>::iterator user_it;
181 stringkey_val = user_it->second;
182 if( key_val.empty() ) key_val =
"NOT_SET";
183log_ofs << user_it->first <<
" ,"<< key_val <<
", ";
186 for( item_itr=
m_sw_map.begin(); item_itr!=
m_sw_map.end(); item_itr++) {
187log_ofs << item_itr->first
189<< item_itr->second.AsString (fmt)
199report_name = report_name +
string(
".") + pid_str;
201 if(log_ofs.fail()) {
202cerr <<
"Can't log profile data to the \""<< report_name<<
"\" errno: " 206log_ofs <<
"#PID: "<<pid_str << endl;
207std::list< std::pair <std::string, std::string> >::iterator it2;
209log_ofs << it2->first <<
","<< it2->second << endl;
void AddUserKV(const std::string &key_name, bool bool_val)
std::list< std::pair< std::string, std::string > > m_user_data
static CRtProfiler * instance
void StopMT(size_t sw_ndx)
bool CheckDoReport(std::string &report_name)
void AddUserKVMT(const std::string &key_name, bool bool_val)
std::list< std::pair< std::string, std::string > > m_markers
CRtProfiler(size_t stop_watch_sz=0)
void AddMarkerMT(std::string new_marker)
void Start(size_t sw_ndx)
std::string AsStringMT(size_t sw_ndx, const CTimeFormat &fmt=kEmptyStr)
CFastMutex m_user_data_mx
std::map< std::string, CStopWatch > m_sw_map
bool DoReport(const CTimeFormat &fmt=kEmptyStr)
std::string AsString(size_t sw_ndx, const CTimeFormat &fmt=kEmptyStr)
void StartMT(size_t sw_ndx)
static CRtProfiler * getInstance()
std::vector< CStopWatch > m_sw_vec
void Allocate(size_t sw_ndx)
std::ofstream out("events_result.xml")
main entry point for tests
static TPid GetPid(void)
Get process identifier (pid) for the current process.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
void Lock(void)
Acquire mutex for the current thread with no nesting checks.
void Unlock(void)
Release mutex with no owner or nesting checks.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
@ eCurrent
Use current time. See also CCurrentTime.
Defines process management classes.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4