Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ internal DateTime StartTimeCore
}
}

/// <summary>
/// Gets the amount of time the associated process has spent utilizing the CPU.
/// It is the sum of the <see cref='System.Diagnostics.Process.UserProcessorTime'/> and
/// <see cref='System.Diagnostics.Process.PrivilegedProcessorTime'/>.
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan TotalProcessorTime
public partial TimeSpan TotalProcessorTime
{
get
{
Expand All @@ -45,14 +37,7 @@ public TimeSpan TotalProcessorTime
}
}

/// <summary>
/// Gets the amount of time the associated process has spent running code
/// inside the application portion of the process (not the operating system core).
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan UserProcessorTime
public partial TimeSpan UserProcessorTime
{
get
{
Expand All @@ -68,11 +53,7 @@ public TimeSpan UserProcessorTime
}
}

/// <summary>Gets the amount of time the process has spent running code inside the operating system core.</summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan PrivilegedProcessorTime
public partial TimeSpan PrivilegedProcessorTime
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ namespace System.Diagnostics
{
public partial class Process : IDisposable
{
/// <summary>Gets the amount of time the process has spent running code inside the operating system core.</summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan PrivilegedProcessorTime
public partial TimeSpan PrivilegedProcessorTime
{
get => IsCurrentProcess ? Environment.CpuUsage.PrivilegedTime : TicksToTimeSpan(GetStat().stime);
}
Expand Down Expand Up @@ -83,15 +79,7 @@ private static DateTime BootTime
return null;
}

/// <summary>
/// Gets the amount of time the associated process has spent utilizing the CPU.
/// It is the sum of the <see cref='System.Diagnostics.Process.UserProcessorTime'/> and
/// <see cref='System.Diagnostics.Process.PrivilegedProcessorTime'/>.
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan TotalProcessorTime
public partial TimeSpan TotalProcessorTime
{
get
{
Expand All @@ -105,14 +93,7 @@ public TimeSpan TotalProcessorTime
}
}

/// <summary>
/// Gets the amount of time the associated process has spent running code
/// inside the application portion of the process (not the operating system core).
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan UserProcessorTime
public partial TimeSpan UserProcessorTime
{
get => IsCurrentProcess ? Environment.CpuUsage.UserTime : TicksToTimeSpan(GetStat().utime);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ public partial class Process

private const int MicrosecondsToSecondsFactor = 1_000_000;

/// <summary>Gets the amount of time the process has spent running code inside the operating system core.</summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan PrivilegedProcessorTime
public partial TimeSpan PrivilegedProcessorTime
{
get
{
Expand Down Expand Up @@ -57,15 +53,7 @@ internal static string GetPathToOpenFile()
return "/usr/bin/open";
}

/// <summary>
/// Gets the amount of time the associated process has spent utilizing the CPU.
/// It is the sum of the <see cref='System.Diagnostics.Process.UserProcessorTime'/> and
/// <see cref='System.Diagnostics.Process.PrivilegedProcessorTime'/>.
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan TotalProcessorTime
public partial TimeSpan TotalProcessorTime
{
get
{
Expand All @@ -80,14 +68,7 @@ public TimeSpan TotalProcessorTime
}
}

/// <summary>
/// Gets the amount of time the associated process has spent running code
/// inside the application portion of the process (not the operating system core).
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan UserProcessorTime
public partial TimeSpan UserProcessorTime
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ internal DateTime StartTimeCore
}
}

/// <summary>
/// Gets the amount of time the associated process has spent utilizing the CPU.
/// It is the sum of the <see cref='System.Diagnostics.Process.UserProcessorTime'/> and
/// <see cref='System.Diagnostics.Process.PrivilegedProcessorTime'/>.
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan TotalProcessorTime
public partial TimeSpan TotalProcessorTime
{
get
{
Expand All @@ -45,14 +37,7 @@ public TimeSpan TotalProcessorTime
}
}

/// <summary>
/// Gets the amount of time the associated process has spent running code
/// inside the application portion of the process (not the operating system core).
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan UserProcessorTime
public partial TimeSpan UserProcessorTime
{
get
{
Expand All @@ -68,11 +53,7 @@ public TimeSpan UserProcessorTime
}
}

/// <summary>Gets the amount of time the process has spent running code inside the operating system core.</summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan PrivilegedProcessorTime
public partial TimeSpan PrivilegedProcessorTime
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,7 @@ internal DateTime StartTimeCore
return ProcessUtils.FindProgramInPath("xdg-open");
}

/// <summary>
/// Gets the amount of time the associated process has spent utilizing the CPU.
/// It is the sum of the <see cref='System.Diagnostics.Process.UserProcessorTime'/> and
/// <see cref='System.Diagnostics.Process.PrivilegedProcessorTime'/>.
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan TotalProcessorTime
public partial TimeSpan TotalProcessorTime
{
get
{
Expand All @@ -61,14 +53,7 @@ public TimeSpan TotalProcessorTime
}
}

/// <summary>
/// Gets the amount of time the associated process has spent running code
/// inside the application portion of the process (not the operating system core).
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan UserProcessorTime
public partial TimeSpan UserProcessorTime
{
get
{
Expand All @@ -79,14 +64,7 @@ public TimeSpan UserProcessorTime
}
}

/// <summary>
/// Gets the amount of time the process has spent running code inside the operating
/// system core.
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan PrivilegedProcessorTime
public partial TimeSpan PrivilegedProcessorTime
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,7 @@ private DateTime ExitTimeCore
get { return GetProcessTimes().ExitTime; }
}

/// <summary>Gets the amount of time the process has spent running code inside the operating system core.</summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan PrivilegedProcessorTime
public partial TimeSpan PrivilegedProcessorTime
{
get => IsCurrentProcess ? Environment.CpuUsage.PrivilegedTime : GetProcessTimes().PrivilegedProcessorTime;
}
Expand All @@ -207,27 +203,12 @@ internal DateTime StartTimeCore
get { return GetProcessTimes().StartTime; }
}

/// <summary>
/// Gets the amount of time the associated process has spent utilizing the CPU.
/// It is the sum of the <see cref='System.Diagnostics.Process.UserProcessorTime'/> and
/// <see cref='System.Diagnostics.Process.PrivilegedProcessorTime'/>.
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan TotalProcessorTime
public partial TimeSpan TotalProcessorTime
{
get => IsCurrentProcess ? Environment.CpuUsage.TotalTime : GetProcessTimes().TotalProcessorTime;
}

/// <summary>
/// Gets the amount of time the associated process has spent running code
/// inside the application portion of the process (not the operating system core).
/// </summary>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public TimeSpan UserProcessorTime
public partial TimeSpan UserProcessorTime
{
get => IsCurrentProcess ? Environment.CpuUsage.UserTime : GetProcessTimes().UserProcessorTime;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ public bool HasExited
}

/// <summary>Gets the time the associated process was started.</summary>
/// <remarks>
/// On Windows, if a handle to the process is available, this property can be read after the process exits.
/// On Unix, this property caches its value on first access. A cached value can be read after the process exits,
/// but accessing an uncached value after the process exits may throw <see cref="InvalidOperationException"/> when the value is unavailable.
/// </remarks>
/// <exception cref="InvalidOperationException">
/// No process is associated with this object; on Windows, there is no process handle available; or on Unix,
/// the value was not cached and is unavailable after the process exited.
/// </exception>
Comment thread
adamsitnik marked this conversation as resolved.
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
Expand All @@ -203,11 +212,11 @@ public DateTime StartTime
}
}

/// <devdoc>
/// <para>
/// Gets the time that the associated process exited.
/// </para>
/// </devdoc>
/// <summary>Gets the time that the associated process exited.</summary>
/// <exception cref="InvalidOperationException">
/// No process is associated with this object, the process has not exited,
/// or there is no process handle available.
/// </exception>
public DateTime ExitTime
{
get
Expand All @@ -222,6 +231,57 @@ public DateTime ExitTime
}
}

/// <summary>Gets the amount of time the process has spent running code inside the operating system core.</summary>
/// <remarks>
/// On Windows, if a handle to the process is available, the value can be retrieved after the process exits.
/// On Unix, the value is unavailable after the process exits.
/// </remarks>
/// <exception cref="InvalidOperationException">
/// No process is associated with this object. On Windows, there is no process handle available.
/// On Unix, the process has exited.
/// </exception>
/// <exception cref="Win32Exception">The operating system could not retrieve process timing information.</exception>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public partial TimeSpan PrivilegedProcessorTime { get; }

Comment thread
adamsitnik marked this conversation as resolved.
/// <summary>
/// Gets the amount of time the associated process has spent utilizing the CPU.
/// It is the sum of the <see cref='UserProcessorTime'/> and <see cref='PrivilegedProcessorTime'/>.
/// </summary>
/// <remarks>
/// On Windows, if a handle to the process is available, the value can be retrieved after the process exits.
/// On Unix, the value is unavailable after the process exits.
/// </remarks>
/// <exception cref="InvalidOperationException">
/// No process is associated with this object. On Windows, there is no process handle available.
/// On Unix, the process has exited.
/// </exception>
/// <exception cref="Win32Exception">The operating system could not retrieve process timing information.</exception>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public partial TimeSpan TotalProcessorTime { get; }

/// <summary>
/// Gets the amount of time the associated process has spent running code
/// inside the application portion of the process (not the operating system core).
/// </summary>
/// <remarks>
/// On Windows, if a handle to the process is available, the value can be retrieved after the process exits.
/// On Unix, the value is unavailable after the process exits.
/// </remarks>
/// <exception cref="InvalidOperationException">
/// No process is associated with this object. On Windows, there is no process handle available.
/// On Unix, the process has exited.
/// </exception>
/// <exception cref="Win32Exception">The operating system could not retrieve process timing information.</exception>
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
public partial TimeSpan UserProcessorTime { get; }

/// <devdoc>
/// <para>
/// Gets
Expand Down
Loading
Loading