Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
Added clock to measure encoding/decoding time
Browse files Browse the repository at this point in the history
  • Loading branch information
Delofon committed Jul 26, 2022
1 parent 2b9fcde commit cc13fa3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions QOIDecoder/DecoderProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ namespace QOIDecoder
class DecoderProgram
{
static bool verbose = false;
static DateTime t1;

static void Main(string[] args)
{
AppDomain.CurrentDomain.ProcessExit += ProcessExitMethod;
t1 = DateTime.UtcNow;

if (args.Length == 0)
{
PrintUsage();
Expand Down Expand Up @@ -211,6 +215,13 @@ static void Main(string[] args)

static void Verbose(string str) { if (verbose) Console.WriteLine(str); }

static void ProcessExitMethod(object sender, EventArgs args)
{
DateTime t2 = DateTime.UtcNow;
TimeSpan time = t2 - t1;
Console.WriteLine($"Finished in {time.TotalMilliseconds} ms.");
}

static void PrintUsage()
{
Console.WriteLine("Usage: qoidecode [options] <source> <destination>\nOptions:\n-h Print usage and exit.\n-v Verbose logging.");
Expand Down
11 changes: 11 additions & 0 deletions QOIEncoder/EncoderProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ namespace QOIEncoder
class EncoderProgram
{
static bool verbose = false;
static DateTime t1;

static void Main(string[] args)
{
AppDomain.CurrentDomain.ProcessExit += ProcessExitMethod;
t1 = DateTime.UtcNow;

if (args.Length == 0)
{
PrintUsage();
Expand Down Expand Up @@ -197,6 +201,13 @@ static void Main(string[] args)

static void Verbose(string str) { if (verbose) Console.WriteLine(str); }

static void ProcessExitMethod(object sender, EventArgs args)
{
DateTime t2 = DateTime.UtcNow;
TimeSpan time = t2 - t1;
Console.WriteLine($"Finished in {time.TotalMilliseconds} ms.");
}

static void PrintUsage()
{
Console.WriteLine("Usage: qoiencode [options] <source> <destination>\nOptions:\n-h Print usage and exit.\n-v Verbose logging.");
Expand Down

0 comments on commit cc13fa3

Please sign in to comment.