Use timer class instead of clock.
Check that file exists before opening.
This commit is contained in:
parent
2ed4fee447
commit
19342d8adf
@ -33,8 +33,8 @@
|
|||||||
#include <nvcore/Ptr.h>
|
#include <nvcore/Ptr.h>
|
||||||
#include <nvcore/StrLib.h>
|
#include <nvcore/StrLib.h>
|
||||||
#include <nvcore/StdStream.h>
|
#include <nvcore/StdStream.h>
|
||||||
|
#include <nvcore/FileSystem.h>
|
||||||
#include <time.h> // clock
|
#include <nvcore/Timer.h>
|
||||||
|
|
||||||
|
|
||||||
struct MyOutputHandler : public nvtt::OutputHandler
|
struct MyOutputHandler : public nvtt::OutputHandler
|
||||||
@ -324,7 +324,12 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @@ Make sure input file exists.
|
// Make sure input file exists.
|
||||||
|
if (!nv::FileSystem::exists(input.str()))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "The file '%s' does not exist.\n", input.str());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Set input options.
|
// Set input options.
|
||||||
nvtt::InputOptions inputOptions;
|
nvtt::InputOptions inputOptions;
|
||||||
@ -501,20 +506,19 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
outputOptions.setContainer(nvtt::Container_DDS10);
|
outputOptions.setContainer(nvtt::Container_DDS10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// printf("Press ENTER.\n");
|
// printf("Press ENTER.\n");
|
||||||
// fflush(stdout);
|
// fflush(stdout);
|
||||||
// getchar();
|
// getchar();
|
||||||
|
|
||||||
clock_t start = clock();
|
Timer timer;
|
||||||
|
timer.start();
|
||||||
|
|
||||||
bool success = compressor.process(inputOptions, compressionOptions, outputOptions);
|
bool success = compressor.process(inputOptions, compressionOptions, outputOptions);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
clock_t end = clock();
|
printf("\rtime taken: %.3f seconds\n", float(timer.elapsed()) / 1000.0f);
|
||||||
printf("\rtime taken: %.3f seconds\n", float(end-start) / CLOCKS_PER_SEC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user