Hash :
c174aa70
Author :
Date :
2024-12-05T15:36:18
Trace perf: add a basic fps limiter
Adds sleeps based on each 4 frames timing (4 instead of just last frame
makes fps a bit closer to requested)
Example:
--fps-limit=30
*RESULT TracePerf_vulkan.wall_time: offscreen_bubble_shooter_and_friends= 33.3556469900 ms
*RESULT TracePerf_vulkan.wall_time: bubble_shooter_and_friends= 33.4376432467 ms
--fps-limit=50
*RESULT TracePerf_vulkan.wall_time: offscreen_bubble_shooter_and_friends= 20.0218095000 ms
*RESULT TracePerf_vulkan.wall_time: bubble_shooter_and_friends= 20.0624947200 ms
--fps-limit=100
*RESULT TracePerf_vulkan.wall_time: offscreen_bubble_shooter_and_friends= 10.1298787483 ms
*RESULT TracePerf_vulkan.wall_time: bubble_shooter_and_friends= 10.1781205983 ms
--fps-limit=200
*RESULT TracePerf_vulkan.wall_time: offscreen_bubble_shooter_and_friends= 5.1289075067 ms
*RESULT TracePerf_vulkan.wall_time: bubble_shooter_and_friends= 5.1571364367 ms
--fps-limit=400
*RESULT TracePerf_vulkan.wall_time: offscreen_bubble_shooter_and_friends= 2.6172564224 ms
*RESULT TracePerf_vulkan.wall_time: bubble_shooter_and_friends= 2.7648291614 ms
Bug: b/376300037
Change-Id: I63ef75fe342b149336c0e274bd9cbf6c3aa34c23
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6072435
Commit-Queue: Roman Lavrov <romanl@google.com>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ANGLEPerfTestArgs.h:
// Command line arguments for angle_perftests.
//
#ifndef TESTS_PERF_TESTS_ANGLE_PERF_TEST_ARGS_H_
#define TESTS_PERF_TESTS_ANGLE_PERF_TEST_ARGS_H_
#include <string>
#include <vector>
#include "common/Optional.h"
namespace angle
{
extern int gStepsPerTrial;
extern int gMaxStepsPerformed;
extern bool gEnableTrace;
extern const char *gTraceFile;
extern const char *gScreenshotDir;
extern bool gSaveScreenshots;
extern int gScreenshotFrame;
extern bool gRunToKeyFrame;
extern bool gVerboseLogging;
extern bool gWarmup;
extern int gTrialTimeSeconds;
extern int gTestTrials;
extern bool gNoFinish;
extern bool gRetraceMode;
extern bool gMinimizeGPUWork;
extern bool gTraceTestValidation;
extern const char *gTraceInterpreter;
extern const char *gPerfCounters;
extern const char *gUseANGLE;
extern const char *gUseGL;
extern bool gOffscreen;
extern bool gVsync;
extern int gFpsLimit;
extern const char *gPrintExtensionsToFile;
extern const char *gRequestedExtensions;
extern bool gIncludeInactiveResources;
// Constant for when trace's frame count should be used
constexpr int kAllFrames = -1;
constexpr int kDefaultScreenshotFrame = 1;
constexpr int kDefaultMaxStepsPerformed = 0;
inline bool OneFrame()
{
return gStepsPerTrial == 1 || gMaxStepsPerformed == 1;
}
} // namespace angle
#endif // TESTS_PERF_TESTS_ANGLE_PERF_TEST_ARGS_H_