DEFINE_int32 + DEFINE_uint32 -> DEFINE_int

There's really no big benefit to distinguishing these.

Change-Id: Ib329d32b1fc43e98ba40658cfea37261203ecdb9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202801
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
Mike Klein 2019-03-21 11:42:21 -05:00 committed by Skia Commit-Bot
parent f9666f5467
commit 5b3f343d25
16 changed files with 57 additions and 120 deletions

View File

@ -14,11 +14,11 @@
#include "GrContextPriv.h"
// These CPU tile sizes are not good per se, but they are similar to what Chrome uses.
static DEFINE_int32(CPUbenchTileW, 256, "Tile width used for CPU SKP playback.");
static DEFINE_int32(CPUbenchTileH, 256, "Tile height used for CPU SKP playback.");
static DEFINE_int(CPUbenchTileW, 256, "Tile width used for CPU SKP playback.");
static DEFINE_int(CPUbenchTileH, 256, "Tile height used for CPU SKP playback.");
static DEFINE_int32(GPUbenchTileW, 1600, "Tile width used for GPU SKP playback.");
static DEFINE_int32(GPUbenchTileH, 512, "Tile height used for GPU SKP playback.");
static DEFINE_int(GPUbenchTileW, 1600, "Tile width used for GPU SKP playback.");
static DEFINE_int(GPUbenchTileH, 512, "Tile height used for GPU SKP playback.");
SKPBench::SKPBench(const char* name, const SkPicture* pic, const SkIRect& clip, SkScalar scale,
bool useMultiPictureDraw, bool doLooping)

View File

@ -26,7 +26,7 @@ static DEFINE_string(shapesType, "mixed",
static DEFINE_string(innerShapesType, "none",
"Type of inner shape to use in ShapesBench. Must be one of: "
"none, rect, oval, rrect, mixed.");
static DEFINE_int32(numShapes, 10000, "Number of shapes to draw in ShapesBench.");
static DEFINE_int(numShapes, 10000, "Number of shapes to draw in ShapesBench.");
static DEFINE_string(shapesSize, "32x32", "Size of shapes to draw in ShapesBench.");
static DEFINE_bool(shapesPersp, false, "Use slight perspective tilt in ShapesBench?");
#endif

View File

@ -103,21 +103,21 @@ static SkString to_string(int n) {
return str;
}
static DEFINE_int32(loops, kDefaultLoops, loops_help_txt().c_str());
static DEFINE_int(loops, kDefaultLoops, loops_help_txt().c_str());
static DEFINE_int32(samples, 10, "Number of samples to measure for each bench.");
static DEFINE_int32(ms, 0, "If >0, run each bench for this many ms instead of obeying --samples.");
static DEFINE_int32(overheadLoops, 100000, "Loops to estimate timer overhead.");
static DEFINE_int(samples, 10, "Number of samples to measure for each bench.");
static DEFINE_int(ms, 0, "If >0, run each bench for this many ms instead of obeying --samples.");
static DEFINE_int(overheadLoops, 100000, "Loops to estimate timer overhead.");
static DEFINE_double(overheadGoal, 0.0001,
"Loop until timer overhead is at most this fraction of our measurments.");
static DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU.");
static DEFINE_int32(gpuFrameLag, 5,
static DEFINE_int(gpuFrameLag, 5,
"If unknown, estimated maximum number of frames GPU allows to lag.");
static DEFINE_string(outResultsFile, "", "If given, write results here as JSON.");
static DEFINE_int32(maxCalibrationAttempts, 3,
static DEFINE_int(maxCalibrationAttempts, 3,
"Try up to this many times to guess loops for a bench, or skip the bench.");
static DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this.");
static DEFINE_int(maxLoops, 1000000, "Never run a bench more times than this.");
static DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
static DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
static DEFINE_string(zoom, "1.0,0",
@ -127,7 +127,7 @@ static DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
static DEFINE_bool(lite, false, "Use SkLiteRecorder in recording benchmarks?");
static DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?");
static DEFINE_bool(loopSKP, true, "Loop SKPs like we do for micro benches?");
static DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
static DEFINE_int(flushEvery, 10, "Flush --outResultsFile every Nth run.");
static DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?");
static DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json");
static DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't time out");

View File

@ -84,8 +84,8 @@ static DEFINE_string(uninterestingHashesFile, "",
"File containing a list of uninteresting hashes. If a result hashes to something in "
"this list, no image is written for that result.");
static DEFINE_int32(shards, 1, "We're splitting source data into this many shards.");
static DEFINE_int32(shard, 0, "Which shard do I run?");
static DEFINE_int(shards, 1, "We're splitting source data into this many shards.");
static DEFINE_int(shard, 0, "Which shard do I run?");
static DEFINE_string(mskps, "", "Directory to read mskps from, or a single mskp file.");
static DEFINE_bool(forceRasterPipeline, false, "sets gSkForceRasterPipelineBlitter");

View File

@ -27,8 +27,8 @@ static DEFINE_double(t0, 0, "Timeline start [0..1].");
static DEFINE_double(t1, 1, "Timeline stop [0..1].");
static DEFINE_double(fps, 30, "Decode frames per second.");
static DEFINE_int32(width , 800, "Render width.");
static DEFINE_int32(height, 600, "Render height.");
static DEFINE_int(width , 800, "Render width.");
static DEFINE_int(height, 600, "Render height.");
namespace {

View File

@ -90,13 +90,13 @@ static void setupOne(skiatest::Reporter* reporter, int col, int row, int rot, in
#include "CommandLineFlags.h"
static DEFINE_int32(processOffset, 0,
static DEFINE_int(processOffset, 0,
"Offset the test by this value. This permits multiple processes "
"to exercise the same test in parallel with different test values.");
static DEFINE_int32(processCount, 1,
static DEFINE_int(processCount, 1,
"Test iteration count. This permits multiple processes "
"to exercise the same test in parallel with different test values.");
static DEFINE_int32(trialRuns, 100, "Run this many tests (defaults to 100).");
static DEFINE_int(trialRuns, 100, "Run this many tests (defaults to 100).");
DEF_TEST(SixtyOvals, reporter) {
bool skipOneOffs = false;

View File

@ -233,8 +233,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
#include "CommandLineFlags.h"
static DEFINE_bool(randomProcessorTest, false,
"Use non-deterministic seed for random processor tests?");
static DEFINE_uint32(processorSeed, 0,
"Use specific seed for processor tests. Overridden by --randomProcessorTest.");
static DEFINE_int(processorSeed, 0,
"Use specific seed for processor tests. Overridden by --randomProcessorTest.");
#if GR_TEST_UTILS

View File

@ -21,7 +21,7 @@ static DEFINE_string2(skps, r, "", ".SKPs to dump.");
static DEFINE_string(match, "", "The usual filters on file names to dump.");
static DEFINE_bool2(optimize, O, false, "Run SkRecordOptimize before dumping.");
static DEFINE_bool(optimize2, false, "Run SkRecordOptimize2 before dumping.");
static DEFINE_int32(tile, 1000000000, "Simulated tile size.");
static DEFINE_int(tile, 1000000000, "Simulated tile size.");
static DEFINE_bool(timeWithCommand, false,
"If true, print time next to command, else in first column.");
static DEFINE_string2(write, w, "", "Write the (optimized) picture to the named file.");

View File

@ -321,10 +321,6 @@ void CommandLineFlags::Parse(int argc, const char* const* argv) {
i++;
flag->setInt(atoi(argv[i]));
break;
case SkFlagInfo::kUint_FlagType:
i++;
flag->setUint(strtoul(argv[i], nullptr, 0));
break;
case SkFlagInfo::kDouble_FlagType:
i++;
flag->setDouble(atof(argv[i]));

View File

@ -19,7 +19,7 @@
*
* DEFINE_bool(name, defaultValue, helpString);
* DEFINE_string(name, defaultValue, helpString);
* DEFINE_int32(name, defaultValue, helpString);
* DEFINE_int(name, defaultValue, helpString);
* DEFINE_double(name, defaultValue, helpString);
*
* Then, in main, call CommandLineFlags::SetUsage() to describe usage and call
@ -46,11 +46,11 @@
*
* Similarly, the line
*
* DEFINE_int32(integer, .., ..);
* DEFINE_int(integer, .., ..);
*
* will create
*
* int32_t FLAGS_integer;
* int FLAGS_integer;
*
* and
*
@ -60,14 +60,6 @@
*
* double FLAGS_real;
*
* and
*
* DEFINE_uint32(unsigned, ...);
*
* will create
*
* uint32_t FLAGS_unsigned;
*
* These flags can be set by specifying, for example, "--integer 7" and
* "--real 3.14" on the command line. Unsigned integers are parsed from the
* command line using strtoul() so will detect the base (0 for octal, and
@ -236,29 +228,17 @@ private:
#define DECLARE_string(name) extern CommandLineFlags::StringArray FLAGS_##name;
#define DEFINE_int32(name, defaultValue, helpString) \
int32_t FLAGS_##name; \
SK_UNUSED static bool unused_##name = \
#define DEFINE_int(name, defaultValue, helpString) \
int FLAGS_##name; \
SK_UNUSED static bool unused_##name = \
SkFlagInfo::CreateIntFlag(TO_STRING(name), &FLAGS_##name, defaultValue, helpString)
#define DEFINE_int32_2(name, shortName, defaultValue, helpString) \
int32_t FLAGS_##name; \
#define DEFINE_int_2(name, shortName, defaultValue, helpString) \
int FLAGS_##name; \
SK_UNUSED static bool unused_##name = SkFlagInfo::CreateIntFlag( \
TO_STRING(name), TO_STRING(shortName), &FLAGS_##name, defaultValue, helpString)
#define DECLARE_int32(name) extern int32_t FLAGS_##name;
#define DEFINE_uint32(name, defaultValue, helpString) \
uint32_t FLAGS_##name; \
SK_UNUSED static bool unused_##name = \
SkFlagInfo::CreateUintFlag(TO_STRING(name), &FLAGS_##name, defaultValue, helpString)
#define DEFINE_uint32_2(name, shortName, defaultValue, helpString) \
uint32_t FLAGS_##name; \
SK_UNUSED static bool unused_##name = SkFlagInfo::CreateUintFlag( \
TO_STRING(name), TO_STRING(shortName), &FLAGS_##name, defaultValue, helpString)
#define DECLARE_uint32(name) extern uint32_t FLAGS_##name;
#define DECLARE_int(name) extern int FLAGS_##name;
#define DEFINE_double(name, defaultValue, helpString) \
double FLAGS_##name; \
@ -273,7 +253,6 @@ public:
kBool_FlagType,
kString_FlagType,
kInt_FlagType,
kUint_FlagType,
kDouble_FlagType,
};
@ -319,8 +298,8 @@ public:
* See comments for CreateBoolFlag.
*/
static bool CreateIntFlag(const char* name,
int32_t* pInt,
int32_t defaultValue,
int* pInt,
int defaultValue,
const char* helpString) {
SkFlagInfo* info = new SkFlagInfo(name, nullptr, kInt_FlagType, helpString, nullptr);
info->fIntValue = pInt;
@ -330,8 +309,8 @@ public:
static bool CreateIntFlag(const char* name,
const char* shortName,
int32_t* pInt,
int32_t defaultValue,
int* pInt,
int defaultValue,
const char* helpString) {
SkFlagInfo* info = new SkFlagInfo(name, shortName, kInt_FlagType, helpString, nullptr);
info->fIntValue = pInt;
@ -339,30 +318,6 @@ public:
return true;
}
/**
* See comments for CreateBoolFlag.
*/
static bool CreateUintFlag(const char* name,
uint32_t* pUint,
uint32_t defaultValue,
const char* helpString) {
SkFlagInfo* info = new SkFlagInfo(name, nullptr, kUint_FlagType, helpString, nullptr);
info->fUintValue = pUint;
*info->fUintValue = info->fDefaultUint = defaultValue;
return true;
}
static bool CreateUintFlag(const char* name,
const char* shortName,
uint32_t* pUint,
uint32_t defaultValue,
const char* helpString) {
SkFlagInfo* info = new SkFlagInfo(name, shortName, kUint_FlagType, helpString, nullptr);
info->fUintValue = pUint;
*info->fUintValue = info->fDefaultUint = defaultValue;
return true;
}
/**
* See comments for CreateBoolFlag.
*/
@ -409,7 +364,7 @@ public:
}
}
void setInt(int32_t value) {
void setInt(int value) {
if (kInt_FlagType == fFlagType) {
*fIntValue = value;
} else {
@ -417,14 +372,6 @@ public:
}
}
void setUint(uint32_t value) {
if (kUint_FlagType == fFlagType) {
*fUintValue = value;
} else {
SkDEBUGFAIL("Can only call setUint on kUint_FlagType");
}
}
void setDouble(double value) {
if (kDouble_FlagType == fFlagType) {
*fDoubleValue = value;
@ -458,7 +405,6 @@ public:
break;
case SkFlagInfo::kString_FlagType: return fDefaultString;
case SkFlagInfo::kInt_FlagType: result.printf("%i", fDefaultInt); break;
case SkFlagInfo::kUint_FlagType: result.printf("0x%08x", fDefaultUint); break;
case SkFlagInfo::kDouble_FlagType: result.printf("%2.2f", fDefaultDouble); break;
default: SkDEBUGFAIL("Invalid flag type");
}
@ -470,7 +416,6 @@ public:
case SkFlagInfo::kBool_FlagType: return SkString("bool");
case SkFlagInfo::kString_FlagType: return SkString("string");
case SkFlagInfo::kInt_FlagType: return SkString("int");
case SkFlagInfo::kUint_FlagType: return SkString("uint");
case SkFlagInfo::kDouble_FlagType: return SkString("double");
default: SkDEBUGFAIL("Invalid flag type"); return SkString();
}
@ -491,8 +436,6 @@ private:
, fDefaultBool(false)
, fIntValue(nullptr)
, fDefaultInt(0)
, fUintValue(nullptr)
, fDefaultUint(0)
, fDoubleValue(nullptr)
, fDefaultDouble(0)
, fStrings(nullptr) {
@ -518,10 +461,8 @@ private:
SkString fExtendedHelpString;
bool* fBoolValue;
bool fDefaultBool;
int32_t* fIntValue;
int32_t fDefaultInt;
uint32_t* fUintValue;
uint32_t fDefaultUint;
int* fIntValue;
int fDefaultInt;
double* fDoubleValue;
double fDefaultDouble;
CommandLineFlags::StringArray* fStrings;

View File

@ -77,7 +77,7 @@ DEFINE_string(lotties, "lotties", "Directory to read (Bodymovin) jsons from.");
DEFINE_string(nimas, "nimas", "Directory to read NIMA animations from.");
#endif
DEFINE_int32(skpViewportSize, 1000, "Width & height of the viewport used to crop skp rendering.");
DEFINE_int(skpViewportSize, 1000, "Width & height of the viewport used to crop skp rendering.");
DEFINE_bool(nativeFonts,
true,
@ -86,7 +86,7 @@ DEFINE_bool(nativeFonts,
DEFINE_string(svgs, "", "Directory to read SVGs from, or a single SVG file.");
DEFINE_int32_2(threads,
DEFINE_int_2(threads,
j,
-1,
"Run threadsafe tests on a threadpool with this many extra threads, "
@ -120,8 +120,8 @@ DEFINE_bool(deltaAA,
"If true, use delta anti-aliasing in suitable cases (it overrides forceAnalyticAA.");
DEFINE_bool(forceDeltaAA, false, "Force delta anti-aliasing for all paths.");
DEFINE_int32(backendTiles, 3, "Number of tiles in the experimental threaded backend.");
DEFINE_int32(backendThreads, 2, "Number of threads in the experimental threaded backend.");
DEFINE_int(backendTiles, 3, "Number of tiles in the experimental threaded backend.");
DEFINE_int(backendThreads, 2, "Number of threads in the experimental threaded backend.");
bool CollectImages(CommandLineFlags::StringArray images, SkTArray<SkString>* output) {
SkASSERT(output);
@ -213,7 +213,7 @@ bool CollectImages(CommandLineFlags::StringArray images, SkTArray<SkString>* out
#include "CommonFlagsGpu.h"
DEFINE_int32(gpuThreads,
DEFINE_int(gpuThreads,
2,
"Create this many extra threads to assist with GPU work, "
"including software path rendering. Defaults to two.");

View File

@ -24,13 +24,13 @@ DECLARE_bool(preAbandonGpuContext);
DECLARE_bool(abandonGpuContext);
DECLARE_bool(releaseAndAbandonGpuContext);
DECLARE_string(skps);
DECLARE_int32(skpViewportSize);
DECLARE_int(skpViewportSize);
DECLARE_string(jpgs);
DECLARE_string(lotties);
DECLARE_string(svgs);
DECLARE_string(nimas);
DECLARE_bool(nativeFonts);
DECLARE_int32(threads);
DECLARE_int(threads);
DECLARE_string(resourcePath);
DECLARE_bool(verbose);
DECLARE_bool(veryVerbose);
@ -42,8 +42,8 @@ DECLARE_bool(deltaAA);
DECLARE_bool(forceDeltaAA);
DECLARE_string(key);
DECLARE_string(properties);
DECLARE_int32(backendTiles);
DECLARE_int32(backendThreads);
DECLARE_int(backendTiles);
DECLARE_int(backendThreads);
/**
* Helper to assist in collecting image paths from |dir| specified through a command line

View File

@ -12,7 +12,7 @@
#include "GrTypesPriv.h"
#include "SkTypes.h"
DECLARE_int32(gpuThreads);
DECLARE_int(gpuThreads);
DECLARE_bool(cachePathMasks);
DECLARE_bool(noGS);
DECLARE_string(pr);

View File

@ -24,7 +24,7 @@
using namespace Response;
static DEFINE_int32(port, 8888, "The port to listen on.");
static DEFINE_int(port, 8888, "The port to listen on.");
static DEFINE_string(address, "127.0.0.1", "The address to bind to.");
static DEFINE_bool(hosted, false, "Running in hosted mode on debugger.skia.org.");

View File

@ -55,19 +55,19 @@
*/
static DEFINE_bool(ddl, false, "record the skp into DDLs before rendering");
static DEFINE_int32(ddlNumAdditionalThreads, 0,
static DEFINE_int(ddlNumAdditionalThreads, 0,
"number of DDL recording threads in addition to main one");
static DEFINE_int32(ddlTilingWidthHeight, 0, "number of tiles along one edge when in DDL mode");
static DEFINE_int(ddlTilingWidthHeight, 0, "number of tiles along one edge when in DDL mode");
static DEFINE_bool(ddlRecordTime, false, "report just the cpu time spent recording DDLs");
static DEFINE_int32(duration, 5000, "number of milliseconds to run the benchmark");
static DEFINE_int32(sampleMs, 50, "minimum duration of a sample");
static DEFINE_int(duration, 5000, "number of milliseconds to run the benchmark");
static DEFINE_int(sampleMs, 50, "minimum duration of a sample");
static DEFINE_bool(gpuClock, false, "time on the gpu clock (gpu work only)");
static DEFINE_bool(fps, false, "use fps instead of ms");
static DEFINE_string(src, "",
"path to a single .skp or .svg file, or 'warmup' for a builtin warmup run");
static DEFINE_string(png, "", "if set, save a .png proof to disk at this file location");
static DEFINE_int32(verbosity, 4, "level of verbosity (0=none to 5=debug)");
static DEFINE_int(verbosity, 4, "level of verbosity (0=none to 5=debug)");
static DEFINE_bool(suppressHeader, false, "don't print a header row before the results");
static const char* header =

View File

@ -74,11 +74,11 @@ static DEFINE_bool(list, false, "List samples?");
static DEFINE_string2(backend, b, "sw", "Backend to use. Allowed values are " BACKENDS_STR ".");
static DEFINE_int32(msaa, 1, "Number of subpixel samples. 0 for no HW antialiasing.");
static DEFINE_int(msaa, 1, "Number of subpixel samples. 0 for no HW antialiasing.");
static DEFINE_string(bisect, "", "Path to a .skp or .svg file to bisect.");
DECLARE_int32(threads)
DECLARE_int(threads)
static DEFINE_string2(file, f, "", "Open a single file for viewing.");