diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py index e6d1d00aa4..f3b478ef92 100644 --- a/.ycm_extra_conf.py +++ b/.ycm_extra_conf.py @@ -35,6 +35,12 @@ '/usr/include', '-isystem', '/usr/local/include', + '-system', + '/usr/include/c++/4.8', + '-I', + '/usr/include/python2.7', + '-I', + 'lib' ] diff --git a/ChangeLog b/ChangeLog index c22c28e5f8..5202393542 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,9 +4,11 @@ scalar field (UNINIT_CTOR) * lib/node.cc: fix for Coverity CID 1173035: Uninitialized scalar field (UNINIT_CTOR) - * lib/hashbits.hh: fix for Coverity CID 1153101: Resource leak in object (CTOR_DTOR_LEAK) + * lib/{perf_metrics.{cc,hh},hashtable.{cc,hh} + ,read_parsers.{cc,hh},trace_logger.{cc,hh}}: ifndef WITH_INTERNAL_METRICS + then lets not + astyle -A10 2014-02-27 Michael R. Crusoe diff --git a/lib/hashtable.cc b/lib/hashtable.cc index 16b463a879..eaa31be0c9 100644 --- a/lib/hashtable.cc +++ b/lib/hashtable.cc @@ -15,7 +15,7 @@ using namespace std; using namespace khmer; using namespace khmer:: read_parsers; - +#ifdef WITH_INTERNAL_METRICS HashTablePerformanceMetrics:: HashTablePerformanceMetrics( ) : IPerformanceMetrics( ), @@ -62,7 +62,7 @@ accumulate_timer_deltas( uint32_t metrics_key ) } } - +#endif Hashtable:: Hasher:: Hasher( @@ -72,7 +72,9 @@ Hasher( ) : pool_id( pool_id ), thread_id( thread_id ), +#ifdef WITH_INTERNAL_METRICS pmetrics( HashTablePerformanceMetrics( ) ), +#endif trace_logger( TraceLogger( trace_level, "hashtable-%lu-%lu.log", diff --git a/lib/hashtable.hh b/lib/hashtable.hh index 6fcd1b9d95..4b1880aecb 100644 --- a/lib/hashtable.hh +++ b/lib/hashtable.hh @@ -36,7 +36,7 @@ #define CALLBACK_PERIOD 100000 namespace khmer { - +#ifdef WITH_INTERNAL_METRICS struct HashTablePerformanceMetrics : public IPerformanceMetrics { @@ -60,7 +60,7 @@ namespace khmer { virtual void accumulate_timer_deltas( uint32_t metrics_key ); }; - +#endif // // Sequence iterator class, test. Not really a C++ iterator yet. // @@ -152,7 +152,9 @@ namespace khmer { uint32_t pool_id; uint32_t thread_id; +#ifdef WITH_INTERNAL_METRICS HashTablePerformanceMetrics pmetrics; +#endif TraceLogger trace_logger; Hasher( diff --git a/lib/perf_metrics.cc b/lib/perf_metrics.cc index e9db836fd2..4b8c9233e7 100644 --- a/lib/perf_metrics.cc +++ b/lib/perf_metrics.cc @@ -9,7 +9,7 @@ namespace khmer { - +#ifdef WITH_INTERNAL_METRICS IPerformanceMetrics:: IPerformanceMetrics( ) { } @@ -28,7 +28,7 @@ _timespec_diff_in_nsecs( timespec const &start, timespec const &stop ) ((stop.tv_sec * 1000000000U) + (uint64_t)stop.tv_nsec) - ((start.tv_sec * 1000000000U) + (uint64_t)start.tv_nsec); } - +#endif } // namespace khmer // vim: set ft=cpp sts=4 sw=4 tw=79: diff --git a/lib/perf_metrics.hh b/lib/perf_metrics.hh index a4cdf66e42..1fe770d729 100644 --- a/lib/perf_metrics.hh +++ b/lib/perf_metrics.hh @@ -19,7 +19,7 @@ namespace khmer { - +#ifdef WITH_INTERNAL_METRICS struct InvalidPerformanceMetricsKey : public std:: exception { }; @@ -27,7 +27,7 @@ struct InvalidPerformanceMetricsKey : public std:: exception struct IPerformanceMetrics { - IPerformanceMetrics( ); + IPerformanceMetrics( ); virtual ~IPerformanceMetrics( ); inline void start_timers( ) @@ -35,7 +35,7 @@ struct IPerformanceMetrics #if defined (__linux__) clock_gettime( CLOCK_REALTIME, &_temp_clock_start ); clock_gettime( CLOCK_THREAD_CPUTIME_ID, &_temp_cpu_start ); -// TODO: Create proper stopwatches for MacOS X and Windows. +// TODO: Create proper stopwatches for MacOS X. #else memset( &_temp_clock_start, 0, sizeof( timespec ) ); memset( &_temp_cpu_start, 0, sizeof( timespec ) ); @@ -46,7 +46,7 @@ struct IPerformanceMetrics #if defined (__linux__) clock_gettime( CLOCK_THREAD_CPUTIME_ID, &_temp_cpu_stop ); clock_gettime( CLOCK_REALTIME, &_temp_clock_stop ); -// TODO: Create proper stopwatches for MacOS X and Windows. +// TODO: Create proper stopwatches for MacOS X. #else memset( &_temp_cpu_stop, 0, sizeof( timespec ) ); memset( &_temp_clock_stop, 0, sizeof( timespec ) ); @@ -69,8 +69,9 @@ protected: }; -} // namespace khmer +#endif // WITH_INTERNAL_METRICS +} // namespace khmer #endif // PERF_METRICS_HH // vim: set ft=cpp sts=4 sw=4 tw=79: diff --git a/lib/read_parsers.cc b/lib/read_parsers.cc index 7d0f1aef56..71cca29eab 100644 --- a/lib/read_parsers.cc +++ b/lib/read_parsers.cc @@ -63,7 +63,7 @@ InvalidFASTQFileFormat( char const * reason, char const * evidence ) : InvalidReadFileFormat( "InvalidFASTQFileFormat", reason, evidence ) { } - +#ifdef WITH_INTERNAL_METRICS StreamReaderPerformanceMetrics:: StreamReaderPerformanceMetrics( ) : IPerformanceMetrics( ), @@ -95,11 +95,14 @@ accumulate_timer_deltas( uint32_t metrics_key ) } } - +#endif IStreamReader:: IStreamReader( ) -: pmetrics( StreamReaderPerformanceMetrics( ) ), +: +#ifdef WITH_INTERNAL_METRICS + pmetrics( StreamReaderPerformanceMetrics( ) ), +#endif _alignment( 0 ), _max_aligned( SSIZE_MAX ), _at_eos( false ) @@ -374,7 +377,7 @@ read_into_cache( uint8_t * const cache, uint64_t const cache_size ) return nbread_total; } - +#ifdef WITH_INTERNAL_METRICS CacheSegmentPerformanceMetrics:: CacheSegmentPerformanceMetrics( ) : IPerformanceMetrics( ), @@ -481,7 +484,7 @@ accumulate_metrics( CacheSegmentPerformanceMetrics &source ) source._accumulated_count; } - +#endif CacheManager:: CacheManager( @@ -548,7 +551,9 @@ CacheSegment( cursor_in_ca_buffer( false ), fill_id( 0 ), found_EOS( false ), +#ifdef WITH_INTERNAL_METRICS pmetrics( CacheSegmentPerformanceMetrics( ) ), +#endif trace_logger( TraceLogger( trace_level, "cmgr-%lu.log", (unsigned long int)thread_id @@ -1176,7 +1181,7 @@ _get_segment_ref_count_ATOMIC( ) return __sync_and_and_fetch( &_segment_ref_count, (uint32_t)0xffffffff ); } - +#ifdef WITH_INTERNAL_METRICS ParserPerformanceMetrics:: ParserPerformanceMetrics( ) : numlines_copied( 0 ), @@ -1194,7 +1199,7 @@ void ParserPerformanceMetrics:: accumulate_timer_deltas( uint32_t metrics_key ) { } - +#endif IParser * const IParser:: @@ -1374,7 +1379,9 @@ ParserState( uint32_t const thread_id, uint8_t const trace_level ) need_new_line( true ), buffer_pos( 0 ), buffer_rem( 0 ), +#ifdef WITH_INTERNAL_METRICS pmetrics( ParserPerformanceMetrics( ) ), +#endif trace_logger( TraceLogger( trace_level, "parser-%lu.log", (unsigned long int)thread_id diff --git a/lib/read_parsers.hh b/lib/read_parsers.hh index 1357e994e8..7a21e355d7 100644 --- a/lib/read_parsers.hh +++ b/lib/read_parsers.hh @@ -98,7 +98,7 @@ struct UnknownPairReadingMode : public std:: exception struct InvalidReadPair : public std:: exception { }; - +#ifdef WITH_INTERNAL_METRICS struct StreamReaderPerformanceMetrics : public IPerformanceMetrics { @@ -117,13 +117,13 @@ struct StreamReaderPerformanceMetrics : public IPerformanceMetrics virtual void accumulate_timer_deltas( uint32_t metrics_key ); }; - +#endif struct IStreamReader { - +#ifdef WITH_INTERNAL_METRICS StreamReaderPerformanceMetrics pmetrics; - +#endif IStreamReader( ); virtual ~IStreamReader( ); @@ -198,7 +198,7 @@ private: }; - +#ifdef WITH_INTERNAL_METRICS struct CacheSegmentPerformanceMetrics : public IPerformanceMetrics { @@ -240,7 +240,7 @@ protected: uint32_t _accumulated_count; }; - +#endif struct CacheManager { @@ -285,7 +285,9 @@ private: std:: string ca_buffer; uint64_t fill_id; bool found_EOS; +#ifdef WITH_INTERNAL_METRICS CacheSegmentPerformanceMetrics pmetrics; +#endif TraceLogger trace_logger; CacheSegment( @@ -360,7 +362,7 @@ struct Read typedef std:: pair< Read, Read > ReadPair; - +#ifdef WITH_INTERNAL_METRICS struct ParserPerformanceMetrics: public IPerformanceMetrics { @@ -374,6 +376,7 @@ struct ParserPerformanceMetrics: public IPerformanceMetrics virtual void accumulate_timer_deltas( uint32_t metrics_key ); }; +#endif struct IParser @@ -446,8 +449,9 @@ protected: uint8_t buffer[ BUFFER_SIZE + 1 ]; uint64_t buffer_pos; uint64_t buffer_rem; - +#ifdef WITH_INTERNAL_METRICS ParserPerformanceMetrics pmetrics; +#endif TraceLogger trace_logger; ParserState( uint32_t const thread_id, uint8_t const trace_level ); diff --git a/lib/trace_logger.cc b/lib/trace_logger.cc index 1a88ee6413..f28f5cda4d 100644 --- a/lib/trace_logger.cc +++ b/lib/trace_logger.cc @@ -27,8 +27,8 @@ TraceLogger( uint8_t const level, FILE * stream_handle ) TraceLogger:: TraceLogger( uint8_t const level, char const * const file_name_format, ... ) - : _level( level ), _shared_stream( false ) #ifdef WITH_INTERNAL_TRACING + : _level( level ), _shared_stream( false ) { char tfile_name[ FILENAME_MAX + 1 ]; va_list varargs; diff --git a/lib/trace_logger.hh b/lib/trace_logger.hh index 5889bdfc2e..c6e66b7a39 100644 --- a/lib/trace_logger.hh +++ b/lib/trace_logger.hh @@ -58,10 +58,9 @@ struct TraceLogger { #endif // !WITH_INTERNAL_TRACING private: - - uint8_t _level; - bool _shared_stream; #ifdef WITH_INTERNAL_TRACING + bool _shared_stream; + uint8_t _level; FILE * _stream_handle; #endif };