Skip to content

Commit 733042c

Browse files
dl2nDan Lovinger
andauthored
DISKSPD 2.1 (#152)
DISKSPD 2.1 7/1/2021 * New `-g<n>i` form allowing throughput limit specification in units of IOPS (per specified blocksize) * New `-rs<pct>` to specify mixed random/sequential operation (pct random); geometric distribution of run lengths * New `-rd<distribution>` to specify non-uniform IO distributions across target * `pct` by target percentage * `abs` by absolute offset * New `-Rp<text|xml>` to show specified parameter set in indicated profile output form; works with -X XML profiles and conventional command line * XML results/profiles are now indented for ease of review * Text result output updates * now shows values in size units (K/M/G, and now TiB) to two decimals * thread stride no longer shown unless specified * -F/-O threadpool parameters shown * XML profiles can now be built more generically * XML profiles can be stated in terms of templated target names (*1, *2), replaced in order from command line invocation * the command line now allows options alongside -X: -v, -z, -R and -W/-d/-C along with template target specs Co-authored-by: Dan Lovinger <[email protected]>
1 parent c60b6ea commit 733042c

39 files changed

+6794
-1959
lines changed

CmdLineParser/CmdLineParser.cpp

Lines changed: 856 additions & 332 deletions
Large diffs are not rendered by default.

CmdRequestCreator/CmdRequestCreator.cpp

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,6 @@ static HANDLE g_hAbortEvent = NULL; // handle to the 'abort' event
5050
static HANDLE g_hEventStarted = NULL; // event signalled to notify that the actual (measured) test is to be started
5151
static HANDLE g_hEventFinished = NULL; // event signalled to notify that the actual test has finished
5252

53-
/*****************************************************************************/
54-
// wrapper for printf. printf cannot be used directly, because IORequestGenerator.dll
55-
// may be consumed by gui app which doesn't have stdout
56-
void WINAPI PrintOut(const char *format, va_list args)
57-
{
58-
vprintf(format, args);
59-
}
60-
61-
/*****************************************************************************/
62-
// wrapper for fprintf. fprintf cannot be used directly, because IORequestGenerator.dll
63-
// may be consumed by gui app which doesn't have stdout
64-
void WINAPI PrintError(const char *format, va_list args)
65-
{
66-
vfprintf(stderr, format, args);
67-
}
68-
6953
/*****************************************************************************/
7054
BOOL WINAPI ctrlCRoutine(DWORD dwCtrlType)
7155
{
@@ -123,6 +107,27 @@ int __cdecl main(int argc, const char* argv[])
123107
return ERROR_PARSE_CMD_LINE;
124108
}
125109

110+
// Instantiate parsers
111+
ResultParser resultParser;
112+
XmlResultParser xmlResultParser;
113+
IResultParser *pResultParser = nullptr;
114+
if (profile.GetResultsFormat() == ResultsFormat::Xml)
115+
{
116+
pResultParser = &xmlResultParser;
117+
}
118+
else
119+
{
120+
pResultParser = &resultParser;
121+
}
122+
123+
// Profile only? If so, complete now.
124+
if (profile.GetProfileOnly())
125+
{
126+
string s = pResultParser->ParseProfile(profile);
127+
printf("%s", s.c_str());
128+
return 0;
129+
}
130+
126131
synch.pfnCallbackTestStarted = TestStarted;
127132
synch.pfnCallbackTestFinished = TestFinished;
128133

@@ -157,20 +162,9 @@ int __cdecl main(int argc, const char* argv[])
157162
//
158163
// call IO request generator
159164
//
160-
ResultParser resultParser;
161-
XmlResultParser xmlResultParser;
162-
IResultParser *pResultParser = nullptr;
163-
if (profile.GetResultsFormat() == ResultsFormat::Xml)
164-
{
165-
pResultParser = &xmlResultParser;
166-
}
167-
else
168-
{
169-
pResultParser = &resultParser;
170-
}
171165

172166
IORequestGenerator ioGenerator;
173-
if (!ioGenerator.GenerateRequests(profile, *pResultParser, (PRINTF)PrintOut, (PRINTF)PrintError, (PRINTF)PrintOut, &synch))
167+
if (!ioGenerator.GenerateRequests(profile, *pResultParser, &synch))
174168
{
175169
if (profile.GetResultsFormat() == ResultsFormat::Xml)
176170
{

Common/CmdLineParser.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,26 @@ class CmdLineParser
4141
bool ParseCmdLine(const int argc, const char *argv[], Profile *pProfile, struct Synchronization *synch, SystemInformation *pSystem = nullptr);
4242

4343
private:
44-
bool _ReadParametersFromCmdLine(const int argc, const char *argv[], Profile *pProfile, struct Synchronization *synch);
45-
bool _ReadParametersFromXmlFile(const char *pszPath, Profile *pProfile);
44+
bool _ReadParametersFromCmdLine(const int argc, const char *argv[], Profile *pProfile, struct Synchronization *synch, bool& fXMLProfile);
45+
bool _ReadParametersFromXmlFile(const char *pszPath, Profile *pProfile, vector<Target> *pvSubstTargets);
4646

4747
bool _ParseETWParameter(const char *arg, Profile *pProfile);
4848
bool _ParseFlushParameter(const char *arg, MemoryMappedIoFlushMode *FlushMode );
4949
bool _ParseAffinity(const char *arg, TimeSpan *pTimeSpan);
50+
bool _ParseRandomDistribution(const char *arg, vector<Target>& vTargets);
5051

5152
void _DisplayUsageInfo(const char *pszFilename) const;
52-
bool _GetSizeInBytes(const char *pszSize, UINT64& ullSize) const;
53+
bool _GetSizeInBytes(const char *pszSize, UINT64& ullSize, const char **pszRest) const;
5354
bool _GetRandomDataWriteBufferData(const string& sArg, UINT64& cb, string& sPath);
5455

55-
// variables that used to be global
56+
static bool _IsSwitchChar(const char c) { return (c == '/' || c == '-'); }
57+
enum class ParseState {
58+
Unknown,
59+
True,
60+
False,
61+
Bad
62+
};
63+
5664
DWORD _dwBlockSize; // block size; other parameters may be stated in blocks
5765
// so the block size is needed to process them
5866

0 commit comments

Comments
 (0)