Exemplo n.º 1
0
        public void Clear()
        {
            IsCleared = true;
            DelegateManager.Clear();

            freeIntepreters.Clear();
            intepreters.Clear();
            crossAdaptors.Clear();
            valueTypeBinders.Clear();
            mapType.Clear();
            clrTypeMapping.Clear();
            mapTypeToken.Clear();
            mapMethod.Clear();
            mapString.Clear();
            redirectMap.Clear();
            fieldGetterMap.Clear();
            fieldSetterMap.Clear();
            memberwiseCloneMap.Clear();
            createDefaultInstanceMap.Clear();
            createArrayInstanceMap.Clear();
            loadedAssemblies = null;
            references.Clear();

            LoadedTypes.Clear();
            RedirectMap.Clear();
            FieldGetterMap.Clear();
            FieldSetterMap.Clear();
            MemberwiseCloneMap.Clear();
            CreateDefaultInstanceMap.Clear();
            CreateArrayInstanceMap.Clear();
            CrossBindingAdaptors.Clear();
            ValueTypeBinders.Clear();
            Intepreters.Clear();
            FreeIntepreters.Clear();
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("ERROR: You must specify a path to the mapping file");
                return;
            }

            if (args.Length > 0)
            {
                var mappingFile = args[0];
                if (!File.Exists(mappingFile))
                {
                    Console.WriteLine($"ERROR: mapping file not found - {mappingFile}");
                    return;
                }
                RedirectMap.Initialize(mappingFile);
            }

            CreateHostBuilder(args).Build().Run();
        }
Exemplo n.º 3
0
        public void Run()
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            EpochManager = new EpochManager(Settings.WeatherDbPath, Settings.MaximumEpochAgeMinutes);
            GeoHasher    = new GvtkGeohasher();
            DeadDogs     = new HashSet <string>();

            long rowCounter  = 0;
            int  fileCounter = 0;

            long previousCounter = 0;

            var timer = new System.Timers.Timer(Settings.StatusMessageCycleSeconds * 1000);

            timer.Elapsed += (a, b) =>
            {
                Log.Info($"Files: {fileCounter} - Rows: {rowCounter} - {(rowCounter - previousCounter) / Settings.StatusMessageCycleSeconds} r/s - Epochs: {EpochManager.EpochsLoaded} - Redirects: {RedirectMap.Count()} - Dead dogs: {DeadDogs.Count()} - Cache hit/miss/total: {EpochManager.CacheHit}/{EpochManager.CacheMiss}/{EpochManager.Lookups} ({EpochManager.CacheHitRatePct}%) - Run time: {stopwatch.Elapsed.ToString("hh\\:mm\\:ss")}");
                previousCounter = rowCounter;
                EpochManager.VacuumPeriodic();
            };
            timer.AutoReset = true;
            timer.Enabled   = true;
            Log.Info("Processing input files..");
            Parallel.ForEach(Analysis.AsParallel().AsOrdered(), new ParallelOptions
            {
                MaxDegreeOfParallelism = Settings.MaxParallellism
            },
                             analysisResult =>
            {
                string msg;
                var sourceFile = analysisResult.Path;

                try
                {
                    msg = ProcessFile(sourceFile, ref rowCounter, ref fileCounter);
                }
                catch (Exception e1)
                {
                    Log.Info("Encountered error: " + e1);
                    Log.Info("Retrying..");
                    try
                    {
                        msg = ProcessFile(sourceFile, ref rowCounter, ref fileCounter);
                    }
                    catch (Exception e2)
                    {
                        Log.Error("Encountered another error: " + e2);
                        Log.Info("Giving up on " + Path.GetFileName(analysisResult.Path));
                    }
                }
            });

            Log.Info("Dumping redirect map..");
            File.WriteAllText("RedirectMap.csv", DumpRedirectMap());
            Log.Info("Dumping dead dogs..");
            File.WriteAllText("DeadDogs.csv", DumpDeadDogs());
            stopwatch.Stop();

            Log.Info("Completed in " + stopwatch.Elapsed.ToString("hh\\:mm\\:ss"));
        }