Example #1
0
		public static void AddOrUpdateChild64(FunctionInfo* parent, FunctionInfo* child, Profiler profiler)
		{
			int slot = child->Id;
			while (true) {
				slot &= parent->LastChildIndex;
				FunctionInfo* slotContent = (FunctionInfo*)profiler.TranslatePointer(GetChildren64(parent)[slot]);
				if (slotContent == null || slotContent->Id == child->Id) {
					GetChildren64(parent)[slot] = profiler.TranslatePointerBack64(child);
					break;
				}
				slot++;
			}
		}
Example #2
0
			public DataSet(Profiler profiler, byte *startPtr, long length, TargetProcessPointer nativeStartPosition,
			               TargetProcessPointer nativeRootFuncInfoPosition, bool isFirst, bool is64Bit)
				: base(nativeStartPosition, nativeRootFuncInfoPosition, startPtr, length, isFirst, is64Bit)
			{
				this.profiler = profiler;
			}
		static ProfilingResults WithProfiler(ProcessStartInfo startInfo)
		{
			string fileName = Path.Combine(Path.GetDirectoryName(typeof(Profiler).Assembly.Location), "output.sdps");
			if (File.Exists(fileName))
				File.Delete(fileName);
			
			using (var profiler = new Profiler(
				startInfo, new ProfilingDataSQLiteWriter(fileName), new ProfilerOptions()
			)) {
				using (ManualResetEvent mre = new ManualResetEvent(false)) {
					profiler.SessionEnded += delegate {
						mre.Set();
					};
					profiler.Start();
					mre.WaitOne();
				}
			}
			return new ProfilingResults {
				DatabaseSize = FormatBytes(new FileInfo(fileName).Length)
			};
		}