Execution time and warnings
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"profiles": {
|
"profiles": {
|
||||||
"BoerseDataConvert": {
|
"BoerseDataConvert": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"commandLineArgs": "-i smalldata.zip -d input -o output"
|
"commandLineArgs": "-i bigdata.zip -d input -o output"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Mono.Options;
|
using Mono.Options;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace BoerseDataConvert
|
namespace BoerseDataConvert
|
||||||
{
|
{
|
||||||
@@ -79,7 +80,8 @@ namespace BoerseDataConvert
|
|||||||
|
|
||||||
Reader reader = new Reader(inputDirectory, fileNames);
|
Reader reader = new Reader(inputDirectory, fileNames);
|
||||||
RecordController a = new RecordController(outputDirectory, fileNames[0], tagsFile);
|
RecordController a = new RecordController(outputDirectory, fileNames[0], tagsFile);
|
||||||
|
Stopwatch totalRunTime = new Stopwatch();
|
||||||
|
totalRunTime.Start();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -89,12 +91,12 @@ namespace BoerseDataConvert
|
|||||||
}
|
}
|
||||||
catch (IndexOutOfRangeException)
|
catch (IndexOutOfRangeException)
|
||||||
{
|
{
|
||||||
Reader.EndFile();
|
|
||||||
RecordController.EndFile();
|
RecordController.EndFile();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Console.WriteLine("INFO: Successful conversion, exiting");
|
totalRunTime.Stop();
|
||||||
|
Console.WriteLine($"INFO: Successful conversion in {totalRunTime.Elapsed:c}, exiting");
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
static void CheckFreeDisk(string zipFile, string outputDirectory)
|
static void CheckFreeDisk(string zipFile, string outputDirectory)
|
||||||
|
|||||||
@@ -5,22 +5,25 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace BoerseDataConvert
|
namespace BoerseDataConvert
|
||||||
{
|
{
|
||||||
public class Reader
|
public class Reader
|
||||||
{
|
{
|
||||||
private string[] filesNames;
|
static Stopwatch stopwatch = new Stopwatch();
|
||||||
|
private static string[] filesNames;
|
||||||
private static StreamReader reader;
|
private static StreamReader reader;
|
||||||
private int fileInd;
|
private static int fileInd;
|
||||||
private string adr;
|
private string adr;
|
||||||
public Reader(string adr, string[] filesNames)
|
public Reader(string adr, string[] _filesNames)
|
||||||
{
|
{
|
||||||
fileInd = 0;
|
fileInd = 0;
|
||||||
reader = new StreamReader($@"{adr}/{filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252));
|
reader = new StreamReader($@"{adr}/{_filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252));
|
||||||
this.adr = adr;
|
this.adr = adr;
|
||||||
this.filesNames = filesNames;
|
filesNames = _filesNames;
|
||||||
string date = reader.ReadLine();
|
string date = reader.ReadLine();
|
||||||
|
stopwatch.Start();
|
||||||
CheckFirstLine(date);
|
CheckFirstLine(date);
|
||||||
}
|
}
|
||||||
public Record ReadLineRecord()
|
public Record ReadLineRecord()
|
||||||
@@ -29,9 +32,9 @@ namespace BoerseDataConvert
|
|||||||
if (reader.EndOfStream)
|
if (reader.EndOfStream)
|
||||||
{
|
{
|
||||||
CheckFinalLine(s);
|
CheckFinalLine(s);
|
||||||
Console.WriteLine($"INFO: { filesNames[fileInd] } was converted successfully");
|
|
||||||
fileInd++;
|
|
||||||
EndFile();
|
EndFile();
|
||||||
|
fileInd++;
|
||||||
|
stopwatch.Start();
|
||||||
reader = new StreamReader($@"{adr}/{filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252));
|
reader = new StreamReader($@"{adr}/{filesNames[fileInd]}", CodePagesEncodingProvider.Instance.GetEncoding(1252));
|
||||||
RecordController.NextFile(filesNames[fileInd]);
|
RecordController.NextFile(filesNames[fileInd]);
|
||||||
string date = reader.ReadLine();
|
string date = reader.ReadLine();
|
||||||
@@ -88,6 +91,9 @@ namespace BoerseDataConvert
|
|||||||
internal static void EndFile()
|
internal static void EndFile()
|
||||||
{
|
{
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
stopwatch.Stop();
|
||||||
|
Console.WriteLine($"INFO: { filesNames[fileInd] } was converted successfully in {stopwatch.Elapsed:c}");
|
||||||
|
stopwatch.Reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user