示例#1
0
 public void StartProfiling(StartProfilingInfo profilingInfo)
 {
     if (profilingInfo is StartProfilingProcessInfo)
     {
         var options = OpenOptionsDialog();
         CurrentSession = KrofilerSession.CreateFromProcess(((StartProfilingProcessInfo)profilingInfo).ExePath, ((StartProfilingProcessInfo)profilingInfo).Args, options);
         Settings.Instance.RecentlyRecordedFiles.Remove(CurrentSession.MlpdPath);
         Settings.Instance.RecentlyRecordedFiles.Insert(0, CurrentSession.MlpdPath);
         Settings.Instance.Save();
     }
     else if (profilingInfo is StartProfilingFromFileInfo)
     {
         CurrentSession = KrofilerSession.CreateFromFile(((StartProfilingFromFileInfo)profilingInfo).MlpdFilePath);
     }
     else
     {
         throw new NotSupportedException($"{profilingInfo.GetType().FullName} is not supported.");
     }
     CurrentSession.NewHeapshot               += HandleNewHeapshot;
     CurrentSession.AllocationsPerSecond      += AllocationsPerSecond;
     CurrentSession.CountersDescriptionsAdded += CountersDescriptionsAdded;
     CurrentSession.CounterSamplesAdded       += CounterSamplesAdded;
     CurrentSession.UserError += UserError;
     CurrentSession.StartParsing();
 }
示例#2
0
 public void StartProfiling(StartProfilingInfo profilingInfo)
 {
     if (profilingInfo is StartProfilingProcessInfo)
     {
         CurrentSession = KrofilerSession.CreateFromProcess(((StartProfilingProcessInfo)profilingInfo).ExePath);
     }
     else if (profilingInfo is StartProfilingFromFileInfo)
     {
         CurrentSession = KrofilerSession.CreateFromFile(((StartProfilingFromFileInfo)profilingInfo).MlpdFilePath);
     }
     else
     {
         throw new NotSupportedException($"{profilingInfo.GetType().FullName} is not supported.");
     }
     CurrentSession.NewHeapshot += HandleNewHeapshot;
     CurrentSession.StartParsing();
 }