Esempio n. 1
0
        private static void ProfileStandaloneTarget(SessionNode session, StandaloneTarget runTarget, bool openReport)
        {
            LaunchConfiguration config;

            if (runTarget.PythonInterpreter != null)
            {
                var registry    = session._serviceProvider.GetComponentModel().GetService <IInterpreterRegistryService>();
                var interpreter = registry.FindConfiguration(runTarget.PythonInterpreter.Id);
                if (interpreter == null)
                {
                    return;
                }
                config = new LaunchConfiguration(interpreter);
            }
            else
            {
                config = new LaunchConfiguration(null);
            }

            config.InterpreterPath  = runTarget.InterpreterPath;
            config.ScriptName       = runTarget.Script;
            config.ScriptArguments  = runTarget.Arguments;
            config.WorkingDirectory = runTarget.WorkingDirectory;

            RunProfiler(session, config, openReport);
        }
Esempio n. 2
0
 internal static bool IsSame(ProfilingTarget self, ProfilingTarget other)
 {
     if (self == null)
     {
         return(other == null);
     }
     else if (other != null)
     {
         return(ProjectTarget.IsSame(self.ProjectTarget, other.ProjectTarget) &&
                StandaloneTarget.IsSame(self.StandaloneTarget, other.StandaloneTarget));
     }
     return(false);
 }
Esempio n. 3
0
        internal StandaloneTarget Clone()
        {
            var res = new StandaloneTarget();

            if (PythonInterpreter != null)
            {
                res.PythonInterpreter = PythonInterpreter.Clone();
            }

            res.InterpreterPath  = InterpreterPath;
            res.WorkingDirectory = WorkingDirectory;
            res.Script           = Script;
            res.Arguments        = Arguments;
            return(res);
        }
Esempio n. 4
0
 internal static bool IsSame(StandaloneTarget self, StandaloneTarget other)
 {
     if (self == null)
     {
         return(other == null);
     }
     else if (other != null)
     {
         return(PythonInterpreter.IsSame(self.PythonInterpreter, other.PythonInterpreter) &&
                self.InterpreterPath == other.InterpreterPath &&
                self.WorkingDirectory == other.WorkingDirectory &&
                self.Script == other.Script &&
                self.Arguments == other.Arguments);
     }
     return(false);
 }
Esempio n. 5
0
 public StandaloneTargetView(IServiceProvider serviceProvider, StandaloneTarget template)
     : this(serviceProvider) {
     if (template.PythonInterpreter != null) {
         Version version;
         if (IsAnyAvailableInterpreters && Version.TryParse(template.PythonInterpreter.Version, out version)) {
             Interpreter = AvailableInterpreters
                 .FirstOrDefault(v => v.Id == template.PythonInterpreter.Id && v.Version == version);
         } else {
             Interpreter = _customInterpreter;
         }
     } else {
         InterpreterPath = template.InterpreterPath;
     }
     ScriptPath = template.Script;
     WorkingDirectory = template.WorkingDirectory;
     Arguments = template.Arguments;
 }
Esempio n. 6
0
        internal ProfilingTarget Clone()
        {
            var res = new ProfilingTarget();

            if (ProjectTarget != null)
            {
                res.ProjectTarget = ProjectTarget.Clone();
            }

            if (StandaloneTarget != null)
            {
                res.StandaloneTarget = StandaloneTarget.Clone();
            }

            if (Reports != null)
            {
                res.Reports = Reports.Clone();
            }

            return(res);
        }
Esempio n. 7
0
        private static void ProfileStandaloneTarget(SessionNode session, StandaloneTarget runTarget, bool openReport)
        {
            var model    = (IComponentModel)(session._serviceProvider.GetService(typeof(SComponentModel)));
            var registry = model.DefaultExportProvider.GetExportedValue <IInterpreterRegistryService>();

            var interpreterPath = runTarget.InterpreterPath;
            var arch            = ProcessorArchitecture.X86;

            if (runTarget.PythonInterpreter != null)
            {
                var interpreter = registry.FindInterpreter(runTarget.PythonInterpreter.Id);
                if (interpreter == null)
                {
                    return;
                }
                interpreterPath = interpreter.Configuration.InterpreterPath;
                arch            = interpreter.Configuration.Architecture;
            }

            RunProfiler(session, interpreterPath, runTarget.Script, runTarget.Arguments, runTarget.WorkingDirectory, null, openReport, arch);
        }
Esempio n. 8
0
 public StandaloneTargetView(IServiceProvider serviceProvider, StandaloneTarget template)
     : this(serviceProvider) {
     if (template.PythonInterpreter != null)
     {
         if (IsAnyAvailableInterpreters)
         {
             Interpreter = AvailableInterpreters
                           .FirstOrDefault(v => v.Id == template.PythonInterpreter.Id);
         }
         else
         {
             Interpreter = _customInterpreter;
         }
     }
     else
     {
         InterpreterPath = template.InterpreterPath;
     }
     ScriptPath       = template.Script;
     WorkingDirectory = template.WorkingDirectory;
     Arguments        = template.Arguments;
 }
Esempio n. 9
0
        private static void ProfileStandaloneTarget(SessionNode session, StandaloneTarget runTarget, bool openReport)
        {
            string interpreter;
            ProcessorArchitecture arch;

            if (runTarget.PythonInterpreter != null)
            {
                Version selectedVersion = new Version(runTarget.PythonInterpreter.Version);
                Guid    interpreterId   = runTarget.PythonInterpreter.Id;
                if (!TryGetInterpreter(selectedVersion, interpreterId, out interpreter, out arch))
                {
                    return;
                }
            }
            else
            {
                interpreter = runTarget.InterpreterPath;
                arch        = ProcessorArchitecture.X86;
            }

            RunProfiler(session, interpreter, runTarget.Script, runTarget.Arguments, runTarget.WorkingDirectory, openReport, arch);
        }
Esempio n. 10
0
 /// <summary>
 /// Create a StandaloneTargetView with values taken from a template.
 /// </summary>
 public StandaloneTargetView(StandaloneTarget template)
     : this(PythonProfilingPackage.Instance, template)
 {
 }
Esempio n. 11
0
 /// <summary>
 /// Create a StandaloneTargetView with values taken from a template.
 /// </summary>
 public StandaloneTargetView(StandaloneTarget template)
     : this(PythonProfilingPackage.Instance, template) {
 }
Esempio n. 12
0
        private static void ProfileStandaloneTarget(SessionNode session, StandaloneTarget runTarget, bool openReport) {
            LaunchConfiguration config;
            if (runTarget.PythonInterpreter != null) {
                var registry = session._serviceProvider.GetComponentModel().GetService<IInterpreterRegistryService>();
                var interpreter = registry.FindConfiguration(runTarget.PythonInterpreter.Id);
                if (interpreter == null) {
                    return;
                }
                config = new LaunchConfiguration(interpreter);
            } else {
                config = new LaunchConfiguration(null);
            }

            config.InterpreterPath = runTarget.InterpreterPath;
            config.ScriptName = runTarget.Script;
            config.ScriptArguments = runTarget.Arguments;
            config.WorkingDirectory = runTarget.WorkingDirectory;

            RunProfiler(session, config, openReport);
        }
Esempio n. 13
0
        private static void ProfileStandaloneTarget(SessionNode session, StandaloneTarget runTarget, bool openReport) {
            var model = (IComponentModel)(session._serviceProvider.GetService(typeof(SComponentModel)));
            var interpreterService = model.GetService<IInterpreterOptionsService>();

            var interpreterPath = runTarget.InterpreterPath;
            var arch = ProcessorArchitecture.X86;
            if (runTarget.PythonInterpreter != null) {
                var interpreter = interpreterService.FindInterpreter(
                    runTarget.PythonInterpreter.Id,
                    runTarget.PythonInterpreter.Version
                );
                if (interpreter == null) {
                    return;
                }
                interpreterPath = interpreter.Configuration.InterpreterPath;
                arch = interpreter.Configuration.Architecture;
            }

            RunProfiler(session, interpreterPath, runTarget.Script, runTarget.Arguments, runTarget.WorkingDirectory, null, openReport, arch);
        }
Esempio n. 14
0
 internal static bool IsSame(StandaloneTarget self, StandaloneTarget other) {
     if (self == null) {
         return other == null;
     } else if (other != null) {
         return PythonInterpreter.IsSame(self.PythonInterpreter, other.PythonInterpreter) &&
             self.InterpreterPath == other.InterpreterPath &&
             self.WorkingDirectory == other.WorkingDirectory &&
             self.Script == other.Script &&
             self.Arguments == other.Arguments;
     }
     return false;
 }
Esempio n. 15
0
        internal StandaloneTarget Clone() {
            var res = new StandaloneTarget();
            if (PythonInterpreter != null) {
                res.PythonInterpreter = PythonInterpreter.Clone();
            }

            res.InterpreterPath = InterpreterPath;
            res.WorkingDirectory = WorkingDirectory;
            res.Script = Script;
            res.Arguments = Arguments;
            return res;

        }