Esempio n. 1
0
        internal static ProcessPipExecutionPerformance Deserialize(BuildXLReader reader, PipExecutionLevel level, DateTime executionStart, DateTime executionStop, uint workerId)
        {
            var fingerprint = FingerprintUtilities.CreateFrom(reader);

            TimeSpan processExecutionTime = reader.ReadTimeSpan();
            FileMonitoringViolationCounters fileMonitoringViolations = ReadFileMonitoringViolationCounters(reader);
            IOCounters            ioCounters     = IOCounters.Deserialize(reader);
            TimeSpan              userTime       = reader.ReadTimeSpan();
            TimeSpan              kernelTime     = reader.ReadTimeSpan();
            ProcessMemoryCounters memoryCounters = ProcessMemoryCounters.Deserialize(reader);

            uint numberOfProcesses = reader.ReadUInt32Compact();

            return(new ProcessPipExecutionPerformance(
                       fingerprint: fingerprint,
                       level: level,
                       executionStart: executionStart,
                       executionStop: executionStop,
                       processExecutionTime: processExecutionTime,
                       fileMonitoringViolations: fileMonitoringViolations,
                       ioCounters: ioCounters,
                       userTime: userTime,
                       kernelTime: kernelTime,
                       memoryCounters: memoryCounters,
                       numberOfProcesses: numberOfProcesses,
                       workerId: workerId));
        }
Esempio n. 2
0
        /// <nodoc />
        public ProcessPipExecutionPerformance(
            PipExecutionLevel level,
            DateTime executionStart,
            DateTime executionStop,
            Fingerprint fingerprint,
            TimeSpan processExecutionTime,
            FileMonitoringViolationCounters fileMonitoringViolations,
            IOCounters ioCounters,
            TimeSpan userTime,
            TimeSpan kernelTime,
            ulong peakMemoryUsage,
            uint numberOfProcesses,
            uint workerId)
            : base(level, executionStart, executionStop, workerId)
        {
            Contract.Requires(executionStart.Kind == DateTimeKind.Utc);
            Contract.Requires(executionStop.Kind == DateTimeKind.Utc);
            Contract.Requires(processExecutionTime >= TimeSpan.Zero);
            Contract.Requires(userTime >= TimeSpan.Zero);
            Contract.Requires(kernelTime >= TimeSpan.Zero);

            ProcessExecutionTime     = processExecutionTime;
            Fingerprint              = fingerprint;
            FileMonitoringViolations = fileMonitoringViolations;
            IO                = ioCounters;
            UserTime          = userTime;
            KernelTime        = kernelTime;
            PeakMemoryUsage   = peakMemoryUsage;
            NumberOfProcesses = numberOfProcesses;
        }
Esempio n. 3
0
        /// <nodoc />
        public ProcessPipExecutionPerformance(
            PipExecutionLevel level,
            DateTime executionStart,
            DateTime executionStop,
            Fingerprint fingerprint,
            TimeSpan processExecutionTime,
            FileMonitoringViolationCounters fileMonitoringViolations,
            IOCounters ioCounters,
            TimeSpan userTime,
            TimeSpan kernelTime,
            ProcessMemoryCounters memoryCounters,
            uint numberOfProcesses,
            uint workerId,
            long suspendedDurationMs)
            : base(level, executionStart, executionStop, workerId)
        {
            Contract.Requires(executionStart.Kind == DateTimeKind.Utc);
            Contract.Requires(executionStop.Kind == DateTimeKind.Utc);
            Contract.Requires(processExecutionTime >= TimeSpan.Zero);
            Contract.Requires(userTime >= TimeSpan.Zero);
            Contract.Requires(kernelTime >= TimeSpan.Zero);

            ProcessExecutionTime     = processExecutionTime;
            Fingerprint              = fingerprint;
            FileMonitoringViolations = fileMonitoringViolations;
            IO                = ioCounters;
            UserTime          = userTime;
            KernelTime        = kernelTime;
            MemoryCounters    = memoryCounters;
            NumberOfProcesses = numberOfProcesses;

            var    durationInMs        = (uint)Math.Min(uint.MaxValue, Math.Max(1, ProcessExecutionTime.TotalMilliseconds));
            double cpuTime             = KernelTime.TotalMilliseconds + UserTime.TotalMilliseconds;
            double processorPercentage = durationInMs == 0 ? 0 : cpuTime / durationInMs;

            ProcessorsInPercents = (ushort)Math.Min(ushort.MaxValue, processorPercentage * 100.0);
            SuspendedDurationMs  = suspendedDurationMs;
        }
Esempio n. 4
0
 private static void WriteFileMonitoringViolationCounters(BuildXLWriter writer, FileMonitoringViolationCounters counters)
 {
     writer.WriteCompact((int)counters.NumFileAccessViolationsNotWhitelisted);
     writer.WriteCompact((int)counters.NumFileAccessesWhitelistedButNotCacheable);
     writer.WriteCompact((int)counters.NumFileAccessesWhitelistedAndCacheable);
 }