処理時間計測の備忘録
BPのある部分のみ処理時間を計測したくなったのを気になったので作成。
この処理自体の処理時間はわかりません。
C++クラスを作成。
.h
UFUNCTION(BlueprintCallable, Category = "Clock") static void StartClock(); UFUNCTION(BlueprintCallable, Category = "Clock") static float EndClock();
.cpp
#include <windows.h> static LARGE_INTEGER freq; static LARGE_INTEGER start_time, end_time; void UClock::StartClock() { QueryPerformanceFrequency(&freq); QueryPerformanceCounter(&start_time); } float UClock::EndClock() { QueryPerformanceCounter(&end_time); return 1000 * (float)(end_time.QuadPart - start_time.QuadPart) / freq.QuadPart; }
適当に重い処理を書いて計測。
こんな感じで使う