yum-archive/TaSTT-Whisper

High-performance GPGPU inference of OpenAI's Whisper automatic speech recognition (ASR) model

git clone https://git.yummers.dev/yum-archive/TaSTT-Whisper

KonstantinSource codes8c4603c

master
590 B26 linesraw
1#pragma once
2
3namespace Whisper
4{
5	// Get current time in CPU clock
6	// More specifically, each CPU core has a timestamp counter which runs at CPU's base frequency, regardless on the frequency scaling of that core.
7	inline int64_t tscNow()
8	{
9		return __rdtsc();
10	}
11
12	// Scale the time interval from CPU time stamp counter clock into 100-nanosecond ticks, rounding to nearest
13	uint64_t ticksFromTsc( uint64_t tscDiff );
14
15	class CpuProfiler
16	{
17		const int64_t started = tscNow();
18
19	public:
20
21		uint64_t elapsed() const
22		{
23			return ticksFromTsc( (uint64_t)( tscNow() - started ) );
24		}
25	};
26}