Ejemplo n.º 1
0
        private void OnAnalysisComplete(object sender, AnalysisCompleteEventArgs e)
        {
            if (e.MillisecondsElapsed < 500)
            {
                return;
            }
            var telemetry = _services.GetService <ITelemetryService>();

            if (telemetry == null)
            {
                return;
            }

            double privateMB;
            double peakPagedMB;
            double workingMB;

            using (var proc = Process.GetCurrentProcess()) {
                privateMB   = proc.PrivateMemorySize64 / 1e+6;
                peakPagedMB = proc.PeakPagedMemorySize64 / 1e+6;
                workingMB   = proc.WorkingSet64 / 1e+6;
            }

            var te = new TelemetryEvent {
                EventName = "python_language_server/analysis_complete", // TODO: Move this common prefix into Core.
            };

            te.Measurements["privateMB"]   = privateMB;
            te.Measurements["peakPagedMB"] = peakPagedMB;
            te.Measurements["workingMB"]   = workingMB;
            te.Measurements["elapsedMs"]   = e.MillisecondsElapsed;
            te.Measurements["moduleCount"] = e.ModuleCount;

            telemetry.SendTelemetryAsync(te).DoNotWait();
        }
Ejemplo n.º 2
0
            public async void AnalysisComplete(object sender, AnalysisCompleteEventArgs e)
            {
                var testCaseData = await _project.Analyzer.SendExtensionCommandAsync(
                    TestAnalyzer.Name,
                    TestAnalyzer.GetTestCasesCommand,
                    e.Path
                    );

                if (testCaseData == null)
                {
                    return;
                }
                var testCases = TestAnalyzer.GetTestCases(testCaseData);

                if (testCases.Length != 0)
                {
                    TestContainer existing;
                    bool          changed = true;
                    if (_containers.TryGetValue(e.Path, out existing))
                    {
                        // we have an existing entry, let's see if any of the tests actually changed.
                        if (existing.TestCases.Length == testCases.Length)
                        {
                            changed = false;

                            for (int i = 0; i < existing.TestCases.Length; i++)
                            {
                                if (!existing.TestCases[i].Equals(testCases[i]))
                                {
                                    changed = true;
                                    break;
                                }
                            }
                        }
                    }

                    if (changed)
                    {
                        // we have a new entry or some of the tests changed
                        int version = (existing?.Version ?? 0) + 1;
                        _containers[e.Path] = new TestContainer(
                            _discoverer,
                            e.Path,
                            _project,
                            version,
                            Architecture,
                            testCases
                            );

                        ContainersChanged();
                    }
                }
                else if (_containers.Remove(e.Path))
                {
                    // Raise containers changed event...
                    ContainersChanged();
                }
            }
Ejemplo n.º 3
0
        private void OnAnalysisComplete(object sender, AnalysisCompleteEventArgs e)
        {
            if (e.MillisecondsElapsed < 500)
            {
                return;
            }
            var telemetry = _services.GetService <ITelemetryService>();

            if (telemetry == null)
            {
                return;
            }

            try {
                double privateMB;
                double peakPagedMB;
                double workingMB;

                using (var proc = Process.GetCurrentProcess()) {
                    privateMB   = proc.PrivateMemorySize64 / 1e+6;
                    peakPagedMB = proc.PeakPagedMemorySize64 / 1e+6;
                    workingMB   = proc.WorkingSet64 / 1e+6;
                }

                var te = new TelemetryEvent {
                    EventName = "python_language_server/analysis_complete", // TODO: Move this common prefix into Core.
                };

                te.Measurements["privateMB"]   = privateMB;
                te.Measurements["peakPagedMB"] = peakPagedMB;
                te.Measurements["workingMB"]   = workingMB;
                te.Measurements["elapsedMs"]   = e.MillisecondsElapsed;
                te.Measurements["moduleCount"] = e.ModuleCount;
                te.Measurements["rdtCount"]    = _rdt.DocumentCount;

                telemetry.SendTelemetryAsync(te).DoNotWait();
            } catch (Exception ex) when(!ex.IsCriticalException())
            {
                // Workaround for https://github.com/microsoft/python-language-server/issues/1820
                // On some systems random DLL may get missing or otherwise not installed
                // and we don't want to crash b/c of telemetry.
            }
        }
Ejemplo n.º 4
0
 private void OnAnalysisComplete(object sender, AnalysisCompleteEventArgs e) => HandleAnalysisQueueEvent();
Ejemplo n.º 5
0
 private void AnalysisComplete(object sender, AnalysisCompleteEventArgs e)
 {
     PendOrSubmitRequests((ProjectAnalyzer)sender, e.Path)
     .HandleAllExceptions(_discoverer._serviceProvider, GetType())
     .DoNotWait();
 }
Ejemplo n.º 6
0
 private async void AnalysisComplete(object sender, AnalysisCompleteEventArgs e)
 {
     await PendOrSubmitRequests(e.Path)
     .HandleAllExceptions(_discoverer._serviceProvider, GetType())
     .ConfigureAwait(false);
 }
Ejemplo n.º 7
0
 private void IndexLibraries(object o, AnalysisCompleteEventArgs e)
 {
     _log?.Log(TraceEventType.Verbose, Resources.IndexingLibraries);
     _indexManager.IndexSnapshot(_interpreter.ModuleResolution.CurrentPathResolver).DoNotWait();
     _analyzer.AnalysisComplete -= IndexLibraries;
 }
Ejemplo n.º 8
0
 private async void AnalysisComplete(object sender, AnalysisCompleteEventArgs e)
 {
     await UpdateTestCasesAsync(e.Path, true).HandleAllExceptions(_discoverer._serviceProvider, GetType());
 }
Ejemplo n.º 9
0
 public void AnalysisComplete(object sender, AnalysisCompleteEventArgs e)
 {
     WriteToLog("Analysis finished...");
 }
Ejemplo n.º 10
0
 private void OnAnalysisComplete(object sender, AnalysisCompleteEventArgs e)
 {
     lock (_lock) {
         UpdateProgressMessage();
     }
 }
 private void OnAnalysisComplete(object sender, AnalysisCompleteEventArgs e) => _taskQueue.ProcessQueue();