/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { #if DEBUG this.Window.Title = "Asteroids-dev-debug"; #else this.Window.Title = "Asteroids-dev-release"; #endif this.Window.Title += " - Version: " + this.GetVersionString(); System.Diagnostics.Trace.WriteLine(DateTime.Now + " " + this.Window.Title); UserConfig.Instance = UserConfig.Load(); WindowSettings.Initialize(this, this.graphics); WindowSettings.SetWindowResolution(new Point(UserConfig.Instance.ScreenWidth, UserConfig.Instance.ScreenHeight)); WindowSettings.SetBorderless(UserConfig.Instance.Borderless); WindowSettings.MinWindowResolution = GameConfig.MinWindowSize; WindowSettings.UnitsVisible = new Vector2(1280, 720); this.renderTarget = new RenderTarget2D(this.GraphicsDevice, WindowSettings.RenderArea.Width, WindowSettings.RenderArea.Height); this.sceneManager = new GUISceneManager(this); this.Components.Add(new Kadro.Input.KeyboardInput(this)); this.Components.Add(new MouseInput(this)); this.Components.Add(new GamepadInput(this)); this.Components.Add(new TouchpanelInput(this)); this.performanceCounter = new PerformanceMetrics(); Assets.Initialize(Content); this.networkManager = new NetworkManager(UserConfig.Instance.NetworkName); this.connectionInfo = new BaseConnection(); base.Initialize(); }
private static AnnotationResources GetAnnotationResources(AnnotationConfig annotationConfig) { var genomeAssembly = GenomeAssemblyHelper.Convert(annotationConfig.genomeAssembly); string cachePathPrefix = LambdaUrlHelper.GetCacheFolder().UrlCombine(genomeAssembly.ToString()).UrlCombine(LambdaUrlHelper.DefaultCacheSource); string nirvanaS3Ref = LambdaUrlHelper.GetRefUrl(genomeAssembly); string saManifestUrl = LambdaUtilities.GetManifestUrl(annotationConfig.supplementaryAnnotations ?? "latest", genomeAssembly); var metrics = new PerformanceMetrics(); var annotationResources = new AnnotationResources(nirvanaS3Ref, cachePathPrefix, saManifestUrl == null? null: new List <string> { saManifestUrl }, annotationConfig.customAnnotations, annotationConfig.customStrUrl, false, false, false, metrics); using (var tabixStream = PersistentStreamUtils.GetReadStream(annotationConfig.tabixUrl)) { annotationResources.InputStartVirtualPosition = GetTabixVirtualPosition(annotationConfig.annotationRange, tabixStream, annotationResources.SequenceProvider.RefNameToChromosome); } Logger.WriteLine($"Tabix position :{annotationResources.InputStartVirtualPosition}"); return(annotationResources); }
public void AccountTime( StatementMetricHandle metricsHandle, PerformanceMetrics performanceMetrics, int numInputEvents) { stmtMetricRepository.AccountTimes(metricsHandle, performanceMetrics, numInputEvents); }
public void AddMetrics(PerformanceMetrics performanceMetrics) { lock (this) { _performanceMetrics.UserTime += performanceMetrics.UserTime; _performanceMetrics.PrivTime += performanceMetrics.PrivTime; _performanceMetrics.TotalTime += performanceMetrics.TotalTime; } }
public void QueueYouTubeChecks() { _youtubeTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = false; metrics.Platform = Constants.YouTube; metrics.ScheduledInterval = _botSettings.IntervalSettings.YouTubeLive; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogYouTubeGaming("Checking YouTube Gaming Channels."); await _platformServices.CheckYouTubeLive(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogYouTubeGaming("YouTube Gaming Check Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.YouTubeLive); _youtubePublishedTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = false; metrics.Platform = Constants.YouTube; metrics.ScheduledInterval = _botSettings.IntervalSettings.YouTubePublished; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogYouTube("Checking YouTube Published"); await _platformServices.CheckPublishedYouTube(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogYouTube("YouTube Published Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.YouTubePublished); _youtubePublishedOwnerTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = true; metrics.Platform = Constants.YouTube; metrics.ScheduledInterval = _botSettings.IntervalSettings.YouTubePublished; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogYouTube("Checking Owner YouTube Published"); await _platformServices.CheckOwnerPublishedYouTube(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogYouTube("Owner YouTube Published Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.YouTubePublished); }
public static ExitCodes Annotate(Stream headerStream, Stream inputVcfStream, Stream outputJsonStream, Stream outputJsonIndexStream, AnnotationResources annotationResources, IVcfFilter vcfFilter, bool ignoreEmptyChromosome = false) { var logger = outputJsonStream is BlockGZipStream ? new ConsoleLogger() : (ILogger) new NullLogger(); var metrics = new PerformanceMetrics(logger); using (annotationResources) using (var vcfReader = GetVcfReader(headerStream, inputVcfStream, annotationResources, vcfFilter)) using (var jsonWriter = new JsonWriter(outputJsonStream, outputJsonIndexStream, annotationResources, Date.CurrentTimeStamp, vcfReader.GetSampleNames(), false)) { try { CheckGenomeAssembly(annotationResources, vcfReader); SetMitochondrialAnnotationBehavior(annotationResources, vcfReader); int previousChromIndex = -1; IPosition position; while ((position = vcfReader.GetNextPosition()) != null) { if (ignoreEmptyChromosome && position.Chromosome.IsEmpty()) { continue; } if (previousChromIndex != position.Chromosome.Index) { annotationResources.PreLoad(position.Chromosome); } previousChromIndex = UpdatePerformanceMetrics(previousChromIndex, position.Chromosome, metrics); var annotatedPosition = position.Variants != null?annotationResources.Annotator.Annotate(position) : null; string json = annotatedPosition?.GetJsonString(); if (json != null) { jsonWriter.WriteJsonEntry(annotatedPosition.Position, json); } metrics.Increment(); } jsonWriter.WriteAnnotatedGenes(annotationResources.Annotator.GetGeneAnnotations()); } catch (Exception e) { e.Data[ExitCodeUtilities.VcfLine] = vcfReader.VcfLine; throw; } } metrics.ShowAnnotationTime(); return(ExitCodes.Success); }
private static int UpdatePerformanceMetrics(int previousChromIndex, IChromosome chromosome, PerformanceMetrics metrics) { // ReSharper disable once InvertIf if (chromosome.Index != previousChromIndex) { metrics.StartAnnotatingReference(chromosome); previousChromIndex = chromosome.Index; } return(previousChromIndex); }
/// <summary> /// Account statement times. /// </summary> /// <param name="handle">statement handle</param> /// <param name="performanceMetrics">performance metrics</param> /// <param name="numInput">number of input rows</param> public void AccountTimes( StatementMetricHandle handle, PerformanceMetrics performanceMetrics, int numInput) { var array = groupMetrics[handle.GroupNum]; using (array.RWLock.AcquireReadLock()) { var metric = array.GetAddMetric(handle.Index); metric.AddMetrics(performanceMetrics); metric.AddNumInput(numInput); } }
public AnnotationResources(string refSequencePath, string inputCachePrefix, List <string> saDirectoryPaths, List <SaUrls> customAnnotations, string customStrTsvPath, bool disableRecomposition, bool forceMitochondrialAnnotation, bool useLegacyVids, PerformanceMetrics metrics) { Metrics = metrics; PerformanceMetrics.ShowInitializationHeader(); SequenceProvider = ProviderUtilities.GetSequenceProvider(refSequencePath); var annotationFiles = new AnnotationFiles(); saDirectoryPaths?.ForEach(x => annotationFiles.AddFiles(x)); customAnnotations?.ForEach(x => annotationFiles.AddFiles(x)); ProteinConservationProvider = ProviderUtilities.GetProteinConservationProvider(annotationFiles); ProteinConservationProvider?.Load(); metrics.Cache.Start(); TranscriptAnnotationProvider = ProviderUtilities.GetTranscriptAnnotationProvider(inputCachePrefix, SequenceProvider, ProteinConservationProvider); metrics.ShowCacheLoad(); SaProvider = ProviderUtilities.GetNsaProvider(annotationFiles); ConservationProvider = ProviderUtilities.GetConservationProvider(annotationFiles); LcrProvider = ProviderUtilities.GetLcrProvider(annotationFiles); RefMinorProvider = ProviderUtilities.GetRefMinorProvider(annotationFiles); GeneAnnotationProvider = ProviderUtilities.GetGeneAnnotationProvider(annotationFiles); IRepeatExpansionProvider repeatExpansionProvider = GetRepeatExpansionProvider(SequenceProvider.Assembly, SequenceProvider.RefNameToChromosome, SequenceProvider.RefIndexToChromosome.Count, customStrTsvPath); MitoHeteroplasmyProvider = MitoHeteroplasmyReader.GetProvider(); Annotator = new Annotator(TranscriptAnnotationProvider, SequenceProvider, SaProvider, ConservationProvider, LcrProvider, GeneAnnotationProvider, repeatExpansionProvider); if (useLegacyVids) { VidCreator = new LegacyVariantId(SequenceProvider.RefNameToChromosome); } else { VidCreator = new VariantId(); } Recomposer = disableRecomposition ? new NullRecomposer() : Phantom.Recomposer.Recomposer.Create(SequenceProvider, TranscriptAnnotationProvider, VidCreator); DataSourceVersions = GetDataSourceVersions(TranscriptAnnotationProvider, SaProvider, GeneAnnotationProvider, ConservationProvider, LcrProvider, MitoHeteroplasmyProvider) .ToList(); VepDataVersion = TranscriptAnnotationProvider.VepVersion + "." + CacheConstants.DataVersion + "." + SaCommon.DataVersion; ForceMitochondrialAnnotation = forceMitochondrialAnnotation; }
} //network is training indicator public Network() { Ip = null; Lr = null; Filename = ""; //subscribe to configuration data changed NetConfigData.DataItemChanged += NetConfigDataChanged; Metrics = new PerformanceMetrics(); TrainRequest = false; TrainingInProgress = false; }
/// <summary> /// Initializes a new instance of the <see cref="StatementMetric"/> class. /// </summary> /// <param name="runtimeURI">The runtime URI.</param> /// <param name="deploymentId">The deployment identifier.</param> /// <param name="statementName">Name of the statement.</param> public StatementMetric( string runtimeURI, string deploymentId, string statementName) : base(runtimeURI) { DeploymentId = deploymentId; StatementName = statementName; _performanceMetrics = default(PerformanceMetrics); _numOutputIStream = 0L; _numOutputRStream = 0L; _numInput = 0L; }
/// <summary> /// constructor /// </summary> public PianoAnnotationSource(Stream transcriptCacheStream, CompressedSequenceReader compressedSequenceReader) { OverlappingTranscripts = new List <Transcript>(); _performanceMetrics = PerformanceMetrics.Instance; _compressedSequence = new CompressedSequence(); _dataFileManager = new DataFileManager(compressedSequenceReader, _compressedSequence); _dataFileManager.Changed += LoadData; _renamer = _compressedSequence.Renamer; _aminoAcids = new AminoAcids(); _vid = new VID(); LoadTranscriptCache(transcriptCacheStream, _renamer.NumRefSeqs, out _transcriptIntervalForest); }
public Network(string filename) : this() { Filename = filename; Trainer = new Trainer(Filename); CreateLayers(); ConnectLayers(); Metrics = new PerformanceMetrics(); Trainer.NextCase(Ip, 0); ScreenUpdateData.DataChanged(); }
//string MyConnection2 = ""; //string MyConnection2 = ""; public async Task LogPerformance(PerformanceMetrics metrics) { //var Query = "INSERT INTO `PerformanceLog`(`Platform`, `IsOwner`, `RunTime`, `ScheduledInterval`, `CreatedDate`) " + // "VALUES('" + metrics.Platform + "'," + metrics.IsOwner + "," + metrics.RunTime + "," + // metrics.ScheduledInterval + ",'" + metrics.CreatedDate.ToString("yyyy-MM-dd HH:mm:ss") + "')"; //MySqlConnection MyConn2 = new MySqlConnection(MyConnection2); //MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2); //MySqlDataReader MyReader2; //MyConn2.Open(); //MyReader2 = MyCommand2.ExecuteReader(); //while (MyReader2.Read()) //{ //} //MyConn2.Close(); //await MyConn2.ClearPoolAsync(MyConn2); //await MyConn2.ClearAllPoolsAsync(); }
private static AnnotationResources GetAnnotationResources(SingleConfig lambdaConfig) { GenomeAssembly genomeAssembly = GenomeAssemblyHelper.Convert(lambdaConfig.genomeAssembly); string cachePathPrefix = CacheUtilities.GetCachePathPrefix(lambdaConfig.vepVersion, genomeAssembly); string nirvanaS3Ref = LambdaUrlHelper.GetRefUrl(genomeAssembly); string annotatorVersion = "Nirvana " + CommandLineUtilities.GetVersion(Assembly.GetAssembly(typeof(SingleAnnotationLambda))); var metrics = new PerformanceMetrics(); Logger.WriteLine($"Cache prefix: {cachePathPrefix}"); //todo: get customStrTsv from lambdaConfig var annotationResources = new AnnotationResources(nirvanaS3Ref, cachePathPrefix, null, lambdaConfig.customAnnotations, null, false, false, false, metrics) { AnnotatorVersionTag = annotatorVersion }; return(annotationResources); }
public void QueueTwitchServerCheck() { _twitchServerTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = false; metrics.Platform = Constants.Twitch + " - Discover"; metrics.ScheduledInterval = _botSettings.IntervalSettings.TwitchServer; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogTwitch("Checking Twitch Server Channels."); await _platformServices.CheckTwitchServer(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogTwitch("Twitch Server Check Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.TwitchServer); }
public void QueueHealthChecks() { _guildCheckTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = true; metrics.Platform = "Bot - Guild Configuration"; metrics.ScheduledInterval = 60000; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogInfo("Checking Guild Configurations."); _guildServices.CheckGuildConfigurations(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogInfo("Guild Configuration Check Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, 600000); }
public void QueuePicartoChecks() { _picartoTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = false; metrics.Platform = Constants.Picarto; metrics.ScheduledInterval = _botSettings.IntervalSettings.Picarto; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogPicarto("Checking Picarto Channels."); await _platformServices.CheckPicartoLive(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogPicarto("Picarto Check Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.Picarto); _picartoOwnerTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = true; metrics.Platform = Constants.Picarto; metrics.ScheduledInterval = _botSettings.IntervalSettings.Picarto; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogPicarto("Checking Picarto Smashcast Channels."); await _platformServices.CheckOwnerPicartoLive(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogPicarto("Owner Picarto Check Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.Picarto); }
public void QueueVidMeChecks() { _vidMeTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = false; metrics.Platform = Constants.VidMe; metrics.ScheduledInterval = _botSettings.IntervalSettings.VidMe; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogVidMe("Checking VidMe"); await _platformServices.CheckVidMe(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogVidMe("VidMe Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.VidMe); _vidMeOwnerTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = true; metrics.Platform = Constants.VidMe; metrics.ScheduledInterval = _botSettings.IntervalSettings.VidMe; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogVidMe("Checking Owner VidMe Published"); await _platformServices.CheckOwnerVidMe(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogVidMe("Owner VidMe Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.VidMe); }
public override void OnEndOfAlgorithm() { try { GenerateTradeSummary(TradeBuilder.ClosedTrades, "Trade Summary (All Trades)"); GenerateTradeSummary(TradeBuilder.ClosedTrades.Where((t) => t.Direction == TradeDirection.Long), "Trade Summary (Long Trades)"); GenerateTradeSummary(TradeBuilder.ClosedTrades.Where((t) => t.Direction == TradeDirection.Short), "Trade Summary (Short Trades)"); var equityChangePerDay = PerformanceMetrics.EquityChangePerDay(TradeBuilder.ClosedTrades); var backtestPeriod = EndDate - StartDate; var TRASYCODRAVOPFACOM = PerformanceMetrics.TRASYCODRAVOPFACOM(TradeBuilder.ClosedTrades, backtestPeriod); var lakeRatio = PerformanceMetrics.LakeRatio(TradeBuilder.ClosedTrades); var blissFunction = PerformanceMetrics.BlissFunction(TradeBuilder.ClosedTrades); Console.WriteLine("TRASYCODRAVOPFACOM: {0} Lake Ratio: {1} Bliss Function: {2}", TRASYCODRAVOPFACOM, lakeRatio, blissFunction); } catch (Exception ex) { Console.WriteLine(ex); } }
private static AnnotationResources GetAnnotationResources() { if (_outputFileName == "-") { Logger.Silence(); } var metrics = new PerformanceMetrics(); var annotationResources = new AnnotationResources(_refSequencePath, _inputCachePrefix, SupplementaryAnnotationDirectories, null, _customStrTsv, _disableRecomposition, _forceMitochondrialAnnotation, _useLegacyVids, metrics); if (SupplementaryAnnotationDirectories.Count == 0) { return(annotationResources); } using (var preloadVcfStream = GZipUtilities.GetAppropriateStream(PersistentStreamUtils.GetReadStream(_vcfPath))) { annotationResources.GetVariantPositions(preloadVcfStream, null); } return(annotationResources); }
public static ExitCodes Annotate(Stream headerStream, Stream inputVcfStream, Stream outputJsonStream, Stream outputJsonIndexStream, AnnotationResources annotationResources, IVcfFilter vcfFilter, bool ignoreEmptyChromosome) { var metrics = annotationResources.Metrics; PerformanceMetrics.ShowAnnotationHeader(); IChromosome currentChromosome = new EmptyChromosome("dummy"); int numVariants = 0; IMitoHeteroplasmyProvider mitoHeteroplasmyProvider = MitoHeteroplasmyReader.GetProvider(); using (var vcfReader = GetVcfReader(headerStream, inputVcfStream, annotationResources, vcfFilter, mitoHeteroplasmyProvider)) using (var jsonWriter = new JsonWriter(outputJsonStream, outputJsonIndexStream, annotationResources, Date.CurrentTimeStamp, vcfReader.GetSampleNames(), false)) { try { CheckGenomeAssembly(annotationResources, vcfReader); SetMitochondrialAnnotationBehavior(annotationResources, vcfReader); IPosition position; while ((position = vcfReader.GetNextPosition()) != null) { IChromosome chromosome = position.Chromosome; if (ignoreEmptyChromosome && chromosome.IsEmpty()) { continue; } if (chromosome.Index != currentChromosome.Index) { if (!currentChromosome.IsEmpty()) { metrics.ShowAnnotationEntry(currentChromosome, numVariants); } numVariants = 0; metrics.Preload.Start(); annotationResources.PreLoad(chromosome); metrics.Preload.Stop(); metrics.Annotation.Start(); currentChromosome = chromosome; } var annotatedPosition = position.Variants != null?annotationResources.Annotator.Annotate(position) : null; string json = annotatedPosition?.GetJsonString(); if (json != null) { jsonWriter.WritePosition(annotatedPosition.Position, json); } numVariants++; } jsonWriter.WriteGenes(annotationResources.Annotator.GetGeneAnnotations()); } catch (Exception e) { e.Data[ExitCodeUtilities.VcfLine] = vcfReader.VcfLine; throw; } } if (!currentChromosome.IsEmpty()) { metrics.ShowAnnotationEntry(currentChromosome, numVariants); } metrics.ShowSummaryTable(); return(ExitCodes.Success); }
private ExitCodes ProgramExecution() { var sequenceProvider = ProviderUtilities.GetSequenceProvider(_refSequencePath); var transcriptAnnotationProvider = ProviderUtilities.GetTranscriptAnnotationProvider(_inputCachePrefix, sequenceProvider); var saProvider = ProviderUtilities.GetSaProvider(SupplementaryAnnotationDirectories); var conservationProvider = ProviderUtilities.GetConservationProvider(SupplementaryAnnotationDirectories); var refMinorProvider = ProviderUtilities.GetRefMinorProvider(SupplementaryAnnotationDirectories); var geneAnnotationProvider = ProviderUtilities.GetGeneAnnotationProvider(SupplementaryAnnotationDirectories); var plugins = PluginUtilities.LoadPlugins(_pluginDirectory); var annotator = ProviderUtilities.GetAnnotator(transcriptAnnotationProvider, sequenceProvider, saProvider, conservationProvider, geneAnnotationProvider, plugins); var recomposer = _disableRecomposition ? new NullRecomposer() : Recomposer.Create(sequenceProvider, _inputCachePrefix); var logger = _outputFileName == "-" ? (ILogger) new NullLogger() : new ConsoleLogger(); var metrics = new PerformanceMetrics(logger); var dataSourceVersions = GetDataSourceVersions(plugins, transcriptAnnotationProvider, saProvider, geneAnnotationProvider, conservationProvider); var vepDataVersion = transcriptAnnotationProvider.VepVersion + "." + CacheConstants.DataVersion + "." + SaDataBaseCommon.DataVersion; var jasixFileName = _outputFileName + ".json.gz" + JasixCommons.FileExt; using (var outputWriter = ReadWriteUtilities.GetOutputWriter(_outputFileName)) using (var vcfReader = ReadWriteUtilities.GetVcfReader(_vcfPath, sequenceProvider.RefNameToChromosome, refMinorProvider, _reportAllSvOverlappingTranscripts, recomposer)) using (var jsonWriter = new JsonWriter(outputWriter, _annotatorVersionTag, Date.CurrentTimeStamp, vepDataVersion, dataSourceVersions, sequenceProvider.GenomeAssembly.ToString(), vcfReader.GetSampleNames())) using (var vcfWriter = _vcf ? new LiteVcfWriter(ReadWriteUtilities.GetVcfOutputWriter(_outputFileName), vcfReader.GetHeaderLines(), _annotatorVersionTag, vepDataVersion, dataSourceVersions) : null) using (var gvcfWriter = _gvcf ? new LiteVcfWriter(ReadWriteUtilities.GetGvcfOutputWriter(_outputFileName), vcfReader.GetHeaderLines(), _annotatorVersionTag, vepDataVersion, dataSourceVersions) : null) using (var jasixIndexCreator = new OnTheFlyIndexCreator(FileUtilities.GetCreateStream(jasixFileName))) { if (!(outputWriter is BgzipTextWriter bgzipTextWriter)) { throw new NullReferenceException("Unable to create the bgzip text writer."); } try { jasixIndexCreator.SetHeader(jsonWriter.Header); if (vcfReader.IsRcrsMitochondrion && annotator.GenomeAssembly == GenomeAssembly.GRCh37 || annotator.GenomeAssembly == GenomeAssembly.GRCh38 || _forceMitochondrialAnnotation) { annotator.EnableMitochondrialAnnotation(); } int previousChromIndex = -1; IPosition position; var sortedVcfChecker = new SortedVcfChecker(); while ((position = vcfReader.GetNextPosition()) != null) { sortedVcfChecker.CheckVcfOrder(position.Chromosome.UcscName); previousChromIndex = UpdatePerformanceMetrics(previousChromIndex, position.Chromosome, metrics); var annotatedPosition = annotator.Annotate(position); string json = annotatedPosition.GetJsonString(); if (json != null) { WriteOutput(annotatedPosition, bgzipTextWriter.Position, jasixIndexCreator, jsonWriter, vcfWriter, gvcfWriter, json); } else { gvcfWriter?.Write(string.Join("\t", position.VcfFields)); } metrics.Increment(); } WriteGeneAnnotations(annotator.GetAnnotatedGenes(), jsonWriter); } catch (Exception e) { e.Data[ExitCodeUtilities.VcfLine] = vcfReader.VcfLine; throw; } } metrics.ShowAnnotationTime(); return(ExitCodes.Success); }
/// <summary> /// Constructs a new graphics instance with the specified multisampling quality. /// </summary> protected GraphicsContext() { // Create performance tracking object Performance = new PerformanceMetrics(); }
public void QueueTwitchChecks() { _twitchTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = false; metrics.Platform = Constants.Twitch; metrics.ScheduledInterval = _botSettings.IntervalSettings.Twitch; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogTwitch("Checking Twitch Channels."); await _platformServices.CheckTwitchLive(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogTwitch("Twitch Check Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); _initialServicesRan = true; }, null, 0, _botSettings.IntervalSettings.Twitch); _twitchFeedTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = false; metrics.Platform = Constants.Twitch + " - Twitch Feed"; metrics.ScheduledInterval = _botSettings.IntervalSettings.TwitchFeed; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogTwitch("Checking Twitch Channel Feeds."); await _platformServices.CheckTwitchChannelFeeds(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogTwitch("Twitch Channel Feed Check Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.TwitchFeed); _twitchOwnerFeedTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = true; metrics.Platform = Constants.Twitch + " - Twitch Feed"; metrics.ScheduledInterval = _botSettings.IntervalSettings.TwitchFeed; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogTwitch("Checking Owner Twitch Channel Feeds."); await _platformServices.CheckTwitchOwnerChannelFeeds(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogTwitch("Owner Twitch Channel Feed Check Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.TwitchFeed); _twitchTeamTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = false; metrics.Platform = Constants.Twitch + " - Teams"; metrics.ScheduledInterval = _botSettings.IntervalSettings.Twitch; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogTwitch("Checking Twitch Teams."); await _platformServices.CheckTwitchTeams(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogTwitch("Checking Twitch Teams Check Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.Twitch); _twitchGameTimer = new Timer(async(e) => { var metrics = new PerformanceMetrics(); metrics.CreatedDate = DateTime.UtcNow; metrics.IsOwner = false; metrics.Platform = Constants.Twitch + " - Games"; metrics.ScheduledInterval = _botSettings.IntervalSettings.Twitch; Stopwatch sw = new Stopwatch(); sw.Start(); Logging.LogTwitch("Checking Twitch Games."); await _platformServices.CheckTwitchGames(); sw.Stop(); metrics.RunTime = sw.ElapsedMilliseconds; await _loggingManager.LogPerformance(metrics); Logging.LogTwitch("Checking Twitch Games Check Complete - Elapsed Runtime: " + sw.ElapsedMilliseconds + " milliseconds."); }, null, 0, _botSettings.IntervalSettings.Twitch); }
public async Task LogPerformance(PerformanceMetrics metrics) { await _loggingDal.LogPerformance(metrics); }