diff options
Diffstat (limited to 'Whisper/Utils/ProfileCollection.h')
| -rw-r--r-- | Whisper/Utils/ProfileCollection.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Whisper/Utils/ProfileCollection.h b/Whisper/Utils/ProfileCollection.h index 732bb48..a03319e 100644 --- a/Whisper/Utils/ProfileCollection.h +++ b/Whisper/Utils/ProfileCollection.h @@ -16,9 +16,11 @@ namespace Whisper { LoadModel, Run, + Callbacks, Spectrogram, Sample, VAD, + Encode, Decode, DecodeStep, DecodeLayer, @@ -62,17 +64,27 @@ namespace Whisper class CpuRaii { - Measure& dest; + Measure* dest; const int64_t tsc; public: - CpuRaii( Measure& m ) : dest( m ), tsc( tscNow() ) + CpuRaii( Measure& m ) : dest( &m ), tsc( tscNow() ) { } + CpuRaii( const CpuRaii& ) = delete; + CpuRaii( CpuRaii&& that ) noexcept : + tsc( that.tsc ) + { + dest = that.dest; + that.dest = nullptr; + } ~CpuRaii() { - const int64_t elapsed = tscNow() - tsc; - dest.add( ticksFromTsc( elapsed ) ); + if( nullptr != dest ) + { + const int64_t elapsed = tscNow() - tsc; + dest->add( ticksFromTsc( elapsed ) ); + } } }; |
