Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
prof.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file
11 /// @brief
12 /// @author
13 /// @author Christopher Miles (cmiles@uw.edu)
14 
15 #include <basic/prof.hh>
16 #include <basic/Tracer.hh>
18 #include <string>
19 #include <time.h>
20 
21 //Auto Headers
22 #include <utility/vector1.hh>
23 #include <ObjexxFCL/format.hh>
24 #include <boost/algorithm/string.hpp>
25 
26 //Auto using namespaces
27 namespace ObjexxFCL { namespace format { } } using namespace ObjexxFCL::format; // AUTO USING NS
28 //Auto using namespaces end
29 
30 namespace basic {
31 
33 
38 
39 clock_t const SHRINK_FACTOR( 2 );
40 
41 double const clock_factor( ( (double) SHRINK_FACTOR * 100.0 ) / CLOCKS_PER_SEC );
42 
43 bool show_time_on_cerr( false );
44 void show_time( basic::Tracer& tr, std::string const& msg ) {
45  using namespace std;
46  time_t rawtime;
47  struct tm * timeinfo;
48  time ( &rawtime );
49  timeinfo = localtime ( &rawtime );
50  std::string date( asctime( timeinfo ) );
51  boost::trim(date);
52  tr.Error << "TIME_STAMP: " << date << " " << msg << std::endl;
53  if ( show_time_on_cerr ) std::cerr << tr.channel() << ": TIME_STAMP: " << date << " " << msg << std::endl;
54 }
55 
57  tag2string.clear();
58  for ( int i=1; i<= n_prof_tags; ++i ) {
59  tag2string.push_back( ObjexxFCL::string_of(i) );
60  }
61 
62  // now fill in
63  tag2string[ TEST1 ] = "TEST1";
64  tag2string[ TEST2 ] = "TEST2";
65  tag2string[ TEST3 ] = "TEST3";
66  tag2string[ TEST4 ] = "TEST4";
67  tag2string[ ATOM_TREE_UPDATE_INTERNAL_COORDS ] = "ATOM_TREE_UPDATE_INTERNAL_COORDS";
68  tag2string[ ATOM_TREE_UPDATE_XYZ_COORDS ] = "ATOM_TREE_UPDATE_XYZ_COORDS";
69  tag2string[ ROTAMER_TRIALS ] = "ROTAMER_TRIALS";
70  tag2string[ PACK_ROTAMERS ] = "PACK_ROTAMERS";
71  tag2string[ UPDATE_RESIDUE_NEIGHBORS ] = "UPDATE_RESIDUE_NEIGHBORS";
72  tag2string[ UPDATE_RESIDUE_TORSIONS ] = "UPDATE_RESIDUE_TORSIONS";
73  tag2string[ UPDATE_RESIDUE_COORDINATES ] = "UPDATE_RESIDUE_COORDINATES";
74  tag2string[ SETUP_NBLIST ] = "SETUP_NBLIST";
75 
76  tag2string[ SCORE ] = "SCORE";
77  tag2string[ SCORE_BEGIN_NOTIFY ] = "SCORE_BEGIN_NOTIFY";
78  tag2string[ SCORE_SETUP ] = "SCORE_SETUP";
79  tag2string[ SCORE_FINALIZE ] = "SCORE_FINALIZE";
80  tag2string[ SCORE_ONEBODY_ENERGIES ] = "SCORE_ONEBODY_ENERGIES";
81  tag2string[ SCORE_NEIGHBOR_ENERGIES ] = "SCORE_NEIGHBOR_ENERGIES";
82  tag2string[ SCORE_LONG_RANGE_ENERGIES ] = "SCORE_LONG_RANGE_ENERGIES";
83  tag2string[ SCORE_DOT ] = "SCORE_DOT";
84  tag2string[ SCORE_END_NOTIFY ] = "SCORE_END_NOTIFY";
85 
86  tag2string[ VDW_ENERGY ] = "VDW_ENERGY";
87  tag2string[ ENERGY_ENVPAIR_POTENTIAL ] ="ENERGY_ENVPAIR_POTENTIAL";
88  tag2string[ SECONDARY_STRUCTURE_ENERGY ] ="SECONDARY_STRUCTURE_ENERGY";
89  tag2string[ SECONDARY_STRUCTURE_SSPAIR_ENERGY ] ="SECONDARY_STRUCTURE_SSPAIR_ENERGY";
90  tag2string[ SECONDARY_STRUCTURE_HSPAIR_ENERGY ] ="SECONDARY_STRUCTURE_HSPAIR_ENERGY";
91  tag2string[ SECONDARY_STRUCTURE_SHEETS_FROM_DIMERS_ENERGY ] ="SECONDARY_STRUCTURE_SHEETS_FROM_DIMERS_ENERGY";
92  tag2string[ POSE_COPY ] = "POSE_COPY";
93 
94  tag2string[ ENERGY_GRAPH_COPY ] = "ENERGY_GRAPH_COPY";
95  tag2string[ ENERGIES_COPY ] = "ENERGIES_COPY";
96 
97  tag2string[ CONFORMATION_DETECT_DISULF ] = "CONFORMATION_DETECT_DISULF";
98  tag2string[ CONFORMATION_FIX_DISULF ] = "CONFORMATION_FIX_DISULF";
99  tag2string[ CONFORMATION_COPY ] ="CONFORMATION_COPY";
100  tag2string[ CHEMICAL_MAKE_POSE ] = "CHEMICAL_MAKE_POSE";
101 
102  tag2string[ CONSTRAINT_SCORE ] = "CONSTRAINT_SCORE";
103  tag2string[ CONSTRAINT_SET_COPY ] = "CONSTRAINT_SET_COPY";
104  tag2string[ CCD_CLOSE ] = "CCD_CLOSE";
105  tag2string[ FUNC ] = "FUNC";
106  tag2string[ DFUNC ] = "DFUNC";
107  tag2string[ GET_ENERGIES ] = "GET_ENERGIES";
108  tag2string[ SIMANNEALING ] = "SIMANNEALING";
109  tag2string[ MC_ACCEPT ] = "MC_ACCEPT";
110  tag2string[ INSERT_FRAGS ] = "INSERT_FRAGS";
111  tag2string[ GB_GET_ALL_BORN_RADII ] = "GB_GET_ALL_BORN_RADII";
112  tag2string[ GB_SETUP_FOR_PACKING ] = "GB_SETUP_FOR_PACKING";
113  tag2string[ GEN_BORN_ROTAMER_PAIR_ENERGIES ] = "GEN_BORN_ROTAMER_PAIR_ENERGIES";
114  tag2string[ GEN_BORN_ROTAMER_BACKGROUND_ENERGIES ] = "GEN_BORN_ROTAMER_BACKGROUND_ENERGIES";
115  tag2string[ MULTIPOLE_SETUP ] = "MULTIPOLE_SETUP";
116  tag2string[ MULTIPOLE_ENERGIES ] = "MULTIPOLE_ENERGIES";
117  tag2string[ FACTS_GET_ALL_BORN_RADII ] = "FACTS_GET_ALL_BORN_RADII";
118  tag2string[ FACTS_SETUP_FOR_PACKING ] = "FACTS_SETUP_FOR_PACKING";
119  tag2string[ FACTS_ROTAMER_PAIR_ENERGIES ] = "FACTS_ROTAMER_PAIR_ENERGIES";
120  tag2string[ FACTS_ROTAMER_BACKGROUND_ENERGIES ] = "FACTS_ROTAMER_BACKGROUND_ENERGIES";
121  tag2string[ MINMOVER_APPLY ] = "MINMOVER_APPLY";
122  tag2string[ BACKRUB_MOVER ] = "BACKRUB_MOVER";
123  tag2string[ FIND_SUGAR_AND_SUITE_FRAGS_I ] = "FIND_SUGAR_AND_SUITE_FRAGS_I";
124  tag2string[ FIND_SUGAR_AND_SUITE_FRAGS_II ] = "FIND_SUGAR_AND_SUITE_FRAGS_II";
125  tag2string[ MAKE_BASE_PAIR_MOVE ] = "MAKE_BASE_PAIR_MOVE";
126  tag2string[ MAKE_BASE_STEP_MOVE ] = "MAKE_BASE_STEP_MOVE";
127  tag2string[ TOTAL ] = "TOTAL";
128 
129  // abinitio debugging tags
130  tag2string[ ABINITIO ] = "ABINITIO";
131  tag2string[ STAGE1 ] = "STAGE1";
132  tag2string[ STAGE2 ] = "STAGE2";
133  tag2string[ STAGE3 ] = "STAGE3";
134  tag2string[ STAGE4 ] = "STAGE4";
135  tag2string[ STAGE5 ] = "STAGE5";
136  tag2string[ FRAGMENT_MOVER ] = "FRAGMENT_MOVER";
137  tag2string[ RG ] = "RG";
138  tag2string[ RG_LOCAL ] = "RG_LOCAL";
139  tag2string[ SEQUENCE_COMPARISON ] = "SEQUENCE_COMPARISON";
140  tag2string[ KDTREE_CONSTRUCT] = "KDTREE_CONSTRUCT";
141  tag2string[ KDTREE_SEARCH] = "KDTREE_SEARCH";
142  tag2string[ CONSTRUCT_DISTANCE_MATRIX] = "CONSTRUCT_DISTANCE_MATRIX";
143 
144  tag2string[ JD2 ] = "JD2";
145  tag2string[ JD2_OUTPUT ] = "JD2_OUTPUT";
146  tag2string[ JD2_SILENT_OUTPUTTER ] = "JD2_SILENT_OUTPUTTER";
147  tag2string[ JD2_INIT_MOVER ] ="JD2_INIT_MOVER";
148  tag2string[ ARCHIVE_SYNC_BATCHES ] = "ARCHIVE_SYNC_BATCHES";
149  tag2string[ ARCHIVE_JOBSCOMPLETE ] = "ARCHIVE_JOBSCOMPLETE";
150  tag2string[ ARCHIVE_CRITICAL_JOBSCOMPLETE ] = "ARCHIVE_CRITICAL_JOBSCOMPLETE";
151  tag2string[ ARCHIVE_READ_DECOYS ] = "ARCHIVE_READ_DECOYS";
152  tag2string[ ARCHIVE_GEN_BATCH ] = "ARCHIVE_GEN_BATCH";
153  tag2string[ ARCHIVE_BLOCK_FILE ] = "ARCHIVE_BLOCK_FILE";
154  tag2string[ ARCHIVE_FILL_POSE ] = "ARCHIVE_FILL_POSE";
155  tag2string[ ARCHIVE_SCORE_POSE ] = "ARCHIVE_SCORE_POSE";
156  tag2string[ ARCHIVE_EVALUATORS ] = "ARCHIVE_EVALUATORS";
157  tag2string[ CA_RMSD_EVALUATION ] = "CA_RMSD_EVALUATION";
158  tag2string[ TRUNCATED_SCORE_EVALUATOR ] ="TRUNCATED_SCORE_EVALUATOR";
159 
160  tag2string[ SAVE_ARCHIVE ] = "SAVE_ARCHIVE";
161 
162  tag2string[ ARCHIVE_EVAL_DECOYS ] = "ARCHIVE_EVAL_DECOYS";
163  tag2string[ SILENT_READ_TAG_TEST ] = "SILENT_READ_TAG_TEST";
164  tag2string[ MPI_FILE_BUF ] = "MPI_FILE_BUF";
165  tag2string[ MPI_JD2_WAITS_FOR_ARCHIVE ] ="MPI_JD2_WAITS_FOR_ARCHIVE";
166  tag2string[ MPI_NOTIFY_ARCHIVE ] = "MPI_NOTIFY_ARCHIVE";
167  tag2string[ SAXS ] = "SAXS";
168 
169  // Fragmentpicker stuff
170  tag2string[ FRAGMENTPICKING_CS_SCORE ] = "FRAGMENTPICKING_CS_SCORE";
171  tag2string[ FRAGMENTPICKING_PROFILE_SCORE ] = "FRAGMENTPICKING_PROFILE_SCORE";
172  tag2string[ FRAGMENTPICKING_PROFILE_CAHING ] = "FRAGMENTPICKING_PROFILE_CAHING";
173  tag2string[ FRAGMENTPICKING_SECONDARY_SCORE ] = "FRAGMENTPICKING_SECONDARY_SCORE";
174  tag2string[ FRAGMENTPICKING_READ_VALL ] = "FRAGMENTPICKING_READ_VALL";
175  tag2string[ FRAGMENTPICKING ] = "FRAGMENTPICKING";
176  tag2string[ FRAGMENTPICKING_CANDIDATES_COLLECTING ] = "FRAGMENTPICKING_CANDIDATES_COLLECTING";
177  tag2string[ FRAGMENTPICKING_ATOMPAIR_SCORE ] = "FRAGMENTPICKING_ATOMPAIR_SCORE";
178  tag2string[ FRAGMENTPICKING_PHIPSI_SCORE ] = "FRAGMENTPICKING_PHIPSI_SCORE";
179  tag2string[ FRAGMENTPICKING_DIHEDRALCONSTR_SCORE ] = "FRAGMENTPICKING_DIHEDRALCONSTR_SCORE";
180 
181  tag2string[ MPICANONICALSAMPLING ] = "MPICANONICALSAMPLING";
182  tag2string[ MPIPOOLCOMMUNICATION ] = "MPIPOOLCOMMUNICATION";
183  tag2string[ MPICOMMCREATION ] = "MPICOMMCREATION";
184  tag2string[ MPIBARRIER ] = "MPIBARRIER";
185  tag2string[ MPIBARRIER_BEGIN ] = "MPIBARRIER_BEGIN";
186  tag2string[ MPIBARRIER_END ] = "MPIBARRIER_END";
187  tag2string[ MPI_GATHER_BARRIER ] = "MPI_GATHER_BARRIER";
188  tag2string[ FARRAY_MANIPULATION ] = "FARRAY_MANIPULATION";
189 
190  tag2string[ MPI_SLAVE_REPORT_NEW_COORDS ] = "MPI_SLAVE_REPORT_NEW_COORDS";
191  tag2string[ MPI_SLAVE_REPORT_SIZES ] = "MPI_SLAVE_REPORT_SIZES";
192 
193  tag2string[ MPI_SEND_UPDATE ] = "MPI_SEND_UPDATE";
194  tag2string[ MPI_SYNC_POOL_DIFF ] = "MPI_SYNC_POOL_DIFF";
195  tag2string[ MPI_SEND_ACCEPTED ] = "MPI_SEND_ACCEPTED";
196 
197  tag2string[ POOL_RMSD_ADD_STRUCTURE ] = "POOL_RMSD_ADD_STRUCTURE";
198  tag2string[ POOL_RMSD_EVALUATE ] = "POOL_RMSD_EVALUATE";
199  tag2string[ POOL_RMSD_MASTER_EVALUATE ] = "POOL_RMSD_MASTER_EVALUATE";
200  tag2string[ MPI_MASTER_BCAST_COORDS ] = "MPI_MASTER_BCAST_COORDS";
201  tag2string[ MPI_MASTER_BCAST_WINNING_RANKS ] = "MPI_MASTER_BCAST_WINNING_RANKS";
202  tag2string[ MPI_MASTER_BCAST_WINNING_STRUCTURES ] = "MPI_MASTER_BCAST_WINNING_STRUCTURES";
203  tag2string[ MPI_MASTER_BCAST_NEW_COMM_SIZE ] = "MPI_MASTER_BCAST_NEW_COMM_SIZE";
204  tag2string[ MPI_MASTER_BCAST_NEW_POOL_RANKS ] = "MPI_MASTER_BCAST_NEW_POOL_RANKS";
205  tag2string[ MPI_MASTER_BCAST_NUM_STRUCTURES_TO_ADD ] = "MPI_MASTER_BCAST_NUM_STRUCTURES_TO_ADD";
206  tag2string[ MPI_POOL_MASTER_THINKS ] = "MPI_POOL_MASTER_THINKS";
207  tag2string[ MPI_POOL_SLAVE_THINKS ] = "MPI_POOL_SLAVE_THINKS";
208  tag2string[ SIDECHAINMCMOVER ] = "SIDECHAINMCMOVER";
209  tag2string[ SIMPLEINTGRAPH ] = "SIMPLEINTGRAPH";
210  tag2string[ SIDECHAINMOVER ] = "SIDECHAINMOVER";
211  tag2string[ INITIALIZE ] = "INITIALIZE";
212  tag2string[ COMM_REDUCE_SIZE ] = "COMM_REDUCE_SIZE";
213  tag2string[ CANONICALMOVER_WRITE_TO_FILE ] = "CANONICALMOVER_WRITE_TO_FILE";
214  tag2string[ WRITE_TO_FILE ] = "WRITE_TO_FILE";
215  tag2string[ CHECK_COMM_SIZE ] = "CHECK_COMM_SIZE";
216  tag2string[ APPLY_MOVE ] = "APPLY_MOVE";
217  tag2string[ DATA_STORAGE ] = "DATA_STORAGE";
218  tag2string[ MASTER_PROCESS_NEW_STRUCTURES ] = "MASTER_PROCESS_NEW_STRUCTURES";
219  tag2string[ COPY_COORDS ] = "COPY_COORDS";
220  tag2string[ APPLY_SC_MOVE ] = "APPLY_SC_MOVE";
221  tag2string[ APPLY_BB_MOVE ] = "APPLY_BB_MOVE";
222 
223  tag2string[ HIERARCHICAL_EVALUATE ] = "HIERARCHICAL_EVALUATE";
224  tag2string[ HIERARCHICAL_ADD ] = "HIERARCHICAL_ADD";
225  tag2string[ LOAD_HIERARCHY ] = "LOAD_HIERARCHY";
226  tag2string[ HIERARCHY_SEND_COORDS ] = "HIERARCHY_SEND_COORDS";
227  tag2string[ HIERARCHY_RECV_COORDS ] = "HIERARCHY_RECV_COORDS";
228  tag2string[ INITIALIZE_HIERARCHY ] = "INITIALIZE_HIERARCHY";
229  tag2string[ WRITE_DECOYS_TO_HIERARCHY ] = "WRITE_DECOYS_TO_HIERARCHY";
230  tag2string[ HIERARCHY_GET_NEXT_CANDIDATE ] = "HIERARCHY_GET_NEXT_CANDIDATE";
231  tag2string[ HIERARCHY_FIND_ADDRESS ] = "HIERARCHY_FIND_ADDRESS";
232  tag2string[ MPIH_EVAL_CHECK_PROGRESS ] = "MPIH_EVAL_CHECK_PROGRESS";
233  tag2string[ MPIH_EVAL_COMMUNICATE_NEW ] = "MPIH_EVAL_COMMUNICATE_NEW";
234  tag2string[ MPIH_EVAL_AGAINST_NBR ] = "MPIH_EVAL_AGAINST_NBR";
235  tag2string[ MPIH_PREPARE_WRITE_STRUCTURES ] = "MPIH_PREPARE_WRITE_STRUCTURES";
236  tag2string[ MPIH_UPDATE_EVAL ] = "MPIH_UPDATE_EVAL";
237  tag2string[ MPIH_ADD_FIRST_STRUCTURE ] = "MPIH_ADD_FIRST_STRUCTURE";
238  tag2string[ MPIH_WRITE_STRUCT ] = "MPIH_WRITE_STRUCT";
239  tag2string[ HIERARCHY_SETUP_TO_RECV ] = "HIERARCHY_SETUP_TO_RECV";
240  tag2string[ FINALIZE ] = "FINALIZE";
241  tag2string[ SORT_POOL ] = "SORT_POOL";
242  tag2string[ HIERARCHICAL_FIND ] = "HIERARCHICAL_FIND";
243  tag2string[ HIERARCHICAL_FIND_ADDRESS ] = "HIERARCHICAL_FIND_ADDRESS";
244  tag2string[ HIERARCHICAL_SORT_ADDRESSES ] = "HIERARCHICAL_SORT_ADDRESSES";
245  tag2string[ HIERARCHICAL_ROUND ] = "HIERARCHICAL_ROUND";
246  tag2string[ HIERARCHICAL_POOL_SIZE ] = "HIERARCHICAL_POOL_SIZE";
247  tag2string[ HIERARCHICAL_ADD_ELEM_TO_CACHE ] = "HIERARCHICAL_ADD_ELEM_TO_CACHE";
248  tag2string[ LIB_FULL_PATH ] = "LIB_FULL_PATH";
249 
250  tag2string[ NOESY_ASSIGN_TOTAL ] = "NOESY_ASSIGN_TOTAL";
251  tag2string[ NOESY_ASSIGN_INITIAL ] = "NOESY_ASSIGN_INITIAL";
252  tag2string[ NOESY_ASSIGN_DIAGONAL ] = "NOESY_ASSIGN_DIAGONAL";
253  tag2string[ NOESY_ASSIGN_CHEMSHIFT ] = "NOESY_ASSIGN_CHEMSHIFT";
254  tag2string[ NOESY_ASSIGN_SYMMETRY ] = "NOESY_ASSIGN_SYMMETRY";
255  tag2string[ NOESY_ASSIGN_DISTANCE ] = "NOESY_ASSIGN_DISTANCE";
256  tag2string[ NOESY_ASSIGN_DECOY_COMP ] = "NOESY_ASSIGN_DECOY_COMP";
257  tag2string[ NOESY_ASSIGN_NETWORK ] = "NOESY_ASSIGN_NETWORK";
258  tag2string[ NOESY_ASSIGN_NETWORK_TOTAL ] = "NOESY_ASSIGN_NETWORK_TOTAL";
259  tag2string[ NOESY_ASSIGN_NETWORK_FIND_RAW_ASSIGN ] = "NOESY_ASSIGN_NETWORK_FIND_RAW_ASSIGN";
260  tag2string[ NOESY_ASSIGN_NETWORK_FILL_COV_GAMMA ] = "NOESY_ASSIGN_NETWORK_FILL_COV_GAMMA";
261  tag2string[ NOESY_ASSIGN_NETWORK_RETRIEVE_ASSIGN ] = "NOESY_ASSIGN_NETWORK_RETRIEVE_ASSIGN";
262  tag2string[ NOESY_ASSIGN_NETWORK_COMPUTE_NK ] = "NOESY_ASSIGN_NETWORK_COMPUTE_NK";
263  tag2string[ NOESY_ASSIGN_NETWORK_PEAK_COUNT ] = "NOESY_ASSIGN_NETWORK_PEAK_COUNT";
264  tag2string[ NOESY_ASSIGN_NETWORK_PEAK_COUNT_EVAL ] = "NOESY_ASSIGN_NETWORK_PEAK_COUNT_EVAL";
265  tag2string[ NOESY_ASSIGN_NETWORK_INVALIDATE_SEQ_NOE ] = "NOESY_ASSIGN_NETWORK_INVALIDATE_SEQ_NOE";
266 
267  tag2string[ NOESY_ASSIGN_UPDATE_PEAK_VOL ] = "NOESY_ASSIGN_UPDATE_PEAK_VOL";
268  tag2string[ NOESY_ASSIGN_CALIBRATE ] = "NOESY_ASSIGN_CALIBRATE";
269  tag2string[ NOESY_ASSIGN_ELIMINATE ] = "NOESY_ASSIGN_ELIMINATE";
270  tag2string[ NOESY_ASSIGN_GEN_CST ] = "NOESY_ASSIGN_GEN_CST";
271  tag2string[ NOESY_ASSIGN_WRITE_CST ] = "NOESY_ASSIGN_WRITE_CST";
272  tag2string[ NOESY_ASSIGN_MAP2CB ] = "NOESY_ASSIGN_MAP2CB";
273  tag2string[ NOESY_ASSIGN_CP_GEN_CST ] = "NOESY_ASSIGN_CP_GEN_CST";
274  tag2string[ NOESY_ASSIGN_PA_GEN_CST ] = "NOESY_ASSIGN_PA_GEN_CST";
275  tag2string[ NOESY_ASSIGN_NMR_STRING ] = "NOESY_ASSIGN_NMR_STRING";
276  tag2string[ NOESY_ASSIGN_REQUIRES_CB_MAPPING ] = "NOESY_ASSIGN_REQUIRES_CB_MAPPING";
277  tag2string[ NOESY_ASSIGN_MAP2CB_NEW ] = "NOESY_ASSIGN_MAP2CB_NEW";
278  tag2string[ NOESY_ASSIGN_WRITE_ASSIGNMENTS ] = "NOESY_ASSIGN_WRITE_ASSIGNMENTS";
279  tag2string[ NOESY_ASSIGN_READ_INPUT ] = "NOESY_ASSIGN_READ_INPUT";
280  tag2string[ NOESY_ASSIGN_DIST_INIT ] = "NOESY_ASSIGN_DIST_INIT";
281  tag2string[ NOESY_ASSIGN_DIST_PREP_SCORE ] = "NOESY_ASSIGN_DIST_PREP_SCORE";
282  tag2string[ NOESY_ASSIGN_DIST_SET_COMPABILITY_SCORE ] = "NOESY_ASSIGN_DIST_SET_COMPABILITY_SCORE";
283  tag2string[ NOESY_ASSIGN_DIST_APPLY ] = "NOESY_ASSIGN_DIST_APPLY";
284  tag2string[ NOESY_ASSIGN_DIST_MAKE_POSE ] = "NOESY_ASSIGN_DIST_MAKE_POSE";
285  tag2string[ NOESY_ASSIGN_DIST_CST_EVAL ] = "NOESY_ASSIGN_DIST_CST_EVAL";
286  tag2string[ NOESY_ASSIGN_DIST_CST_CAST ] = "NOESY_ASSIGN_DIST_CST_CAST";
287  tag2string[ SILENT_FILL_POSE ] = "SILENT_FILL_POSE";
288  tag2string[ SILENT_SET_POSE_COORDS ] = "SILENT_SET_POSE_COORDS";
289  tag2string[ SILENT_FILL_STRUCT ] = "SILENT_FILL_STRUCT";
290 }
291 
292 
293 std::map<std::string, double> dynamic_prof_total;
294 std::map<std::string, int> dynamic_prof_calls;
295 
296 DynamicProfileThis::DynamicProfileThis( std::string const& tag ) {
297  using namespace basic::options;
298  using namespace basic::options::OptionKeys;
299 
300  // don't profile unless instructed to via the option -run:profile
301  if ( !option[basic::options::OptionKeys::run::profile] ) {
302  return;
303  }
304 
305  tag_ = tag;
306  start_clock_ = clock() / SHRINK_FACTOR;
307 }
308 
309 DynamicProfileThis::~DynamicProfileThis() {
310  using namespace basic::options;
311  using namespace basic::options::OptionKeys;
312  // don't profile unless instructed to via the option -run:profile
313  if ( !option[basic::options::OptionKeys::run::profile] ) {
314  return;
315  }
316 
317  clock_t const current( clock() / SHRINK_FACTOR );
318  clock_t const start( start_clock_ );
319 
320  if ( current >= start ) {
321  dynamic_prof_total[ tag_ ] += clock_factor * ( current - start );
322  dynamic_prof_calls[ tag_ ] += 1;
323  }
324 }
325 
326 void prof_show() {
327  using namespace ObjexxFCL;
328  basic::Tracer tt( "core.util.prof", basic::t_info, true /*muted by default*/ );
329 
330  // clocks are shown in the unit of 0.01 sec
331  using namespace basic::options;
332  using namespace basic::options::OptionKeys;
333 
334  // don't profile unless instructed to via the option -run:profile
335  if ( !option[basic::options::OptionKeys::run::profile] ) {
336  return;
337  }
338 
339  static bool init( false );
340  if ( !init ) {
341  init = true;
343  }
344 
346 
347  tt << "\n========================================\n";
348  tt << "========================================\n";
349  tt << "============ PROFILE INFO ==============\n";
350  tt << "========================================\n";
351  tt << "========================================\n";
352  tt << A(12,"clock") << ' ' << A(9,"ncalls") << ' ' << A(9,"bad_calls") << ' ' << A(12,"c/call") << ' ' <<
353  "tag" << '\n';
354  for ( int i=1; i<= n_prof_tags; ++i ) {
355  ProfTag const tag( static_cast< ProfTag >( i ) );
356  double const t( total_clock[ tag ] );
357  int const ncalls( calls[tag] );
358  int const bcalls( bad_calls[tag] );
359  double const clocks_per_call( ncalls != 0 ? t/ncalls : 0.0 );
360  if ( ncalls ) {
361  tt << F(12,2,t) << ' ' << I(9,ncalls) << ' ' << I(9,bcalls)
362  << ' ' << F(12,3, clocks_per_call ) << ' ' << tag2string[tag] << '\n';
363  }
364  }
365  for ( std::map< std::string, double >::const_iterator it=dynamic_prof_total.begin(); it!=dynamic_prof_total.end(); ++it ) {
366  std::string const& tag( it->first );
367  double const t( it->second );
368  int const ncalls( dynamic_prof_calls[tag] );
369  double const clocks_per_call( ncalls != 0 ? t/ncalls : 0.0 );
370  if ( ncalls ) {
371  tt << F(12,2,t) << ' ' << I(9,ncalls) << ' ' << I(9,0)
372  << ' ' << F(12,3, clocks_per_call ) << ' ' << tag << '\n';
373  }
374 
375  }
376  tt << "========================================\n";
377  tt << "========================================\n";
378  tt << "========================================" << std::endl;
379  PROF_START( TOTAL );
380 }
381 
382 void prof_reset() {
383  using namespace basic::options;
384  using namespace basic::options::OptionKeys;
385 
386  // don't profile unless instructed to via the option -run:profile
387  if ( !option[basic::options::OptionKeys::run::profile] ) {
388  return;
389  }
390 
391  start_clock.clear();
392  total_clock.clear();
393  calls.clear();
394  bad_calls.clear();
395 
396  start_clock.resize( n_prof_tags, 0 );
397  total_clock.resize( n_prof_tags, 0 );
398  calls.resize( n_prof_tags, 0 );
399  bad_calls.resize( n_prof_tags, 0 );
400 
401  PROF_START( TOTAL );
402 }
403 
404 
405 } // basic
ocstream cerr(std::cerr)
Wrapper around std::cerr.
Definition: ocstream.hh:290
utility::keys::KeyLookup< KeyType >::const_iterator const_iterator
Key collection iterators.
void setup_tag2string()
Definition: prof.cc:56
utility::vector1< clock_t > start_clock(n_prof_tags, 0)
Definition: prof.hh:307
void date(Fstring &day)
Current Date String (Not Y2K Compliant): DD-MMM-YY.
Definition: Time_Date.cc:70
#define PROF_STOP(expr)
Definition: prof.hh:73
utility::vector1< int > calls(n_prof_tags, 0)
Definition: prof.hh:309
Tracer IO system.
std::map< std::string, int > dynamic_prof_calls
Definition: prof.cc:294
std::string & trim(std::string &s)
Trim Trailing Space from a string.
void show_time(basic::Tracer &tr, std::string const &msg)
Definition: prof.cc:44
TracerProxy Error
Definition: Tracer.hh:262
std::string const & channel() const
Definition: Tracer.hh:200
rule< Scanner, options_closure::context_t > options
Definition: Tag.cc:377
std::map< std::string, double > dynamic_prof_total
Definition: prof.cc:293
void prof_reset()
Definition: prof.cc:382
utility::vector1< int > bad_calls(n_prof_tags, 0)
Definition: prof.hh:310
std::string F(int const w, int const d, float const &t)
Fixed Point Format: float.
Definition: format.cc:387
clock_t const SHRINK_FACTOR(2)
ProfTag
Definition: prof.hh:76
vector1: std::vector with 1-based indexing
Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for ...
Definition: Tracer.hh:134
bool show_time_on_cerr(false)
std::string string_of(Fstring const &s)
string of an Fstring
Definition: Fstring.hh:2889
void init()
set global 'init_was_called' to true
Definition: init.cc:26
rule< Scanner, tag_closure::context_t > tag
Definition: Tag.cc:373
THREAD_LOCAL basic::Tracer tr("struc_set_fragment_picker")
#define PROF_START(expr)
Definition: prof.hh:72
utility::vector1< double > total_clock(n_prof_tags, 0)
Definition: prof.hh:308
utility::vector1< std::string > tag2string
Definition: prof.cc:32
std::string I(int const w, T const &t)
Integer Format.
Definition: format.hh:758
double const clock_factor(((double) SHRINK_FACTOR *100.0)/CLOCKS_PER_SEC)
void prof_show()
Definition: prof.cc:326
std::string A(int const w, char const c)
char Format
Definition: format.cc:175
rule< Scanner, option_closure::context_t > option
Definition: Tag.cc:378