Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Torre committed Apr 27, 2023
2 parents df45dd5 + 82f256f commit e7f8994
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ClusterObserver.nuspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<id>%PACKAGE_ID%</id>
<version>2.2.4</version>
<releaseNotes>
- Code improvements.
- Performance and Code improvements.
</releaseNotes>
<authors>Microsoft</authors>
<license type="expression">MIT</license>
Expand Down
3 changes: 1 addition & 2 deletions FabricObserver.Extensibility/Utilities/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public static class NativeMethods
"FabricDCA.exe", "FabricDnsService.exe", "FabricFAS.exe", "FabricGateway.exe",
"FabricHost.exe", "FabricIS.exe", "FabricRM.exe", "FabricUS.exe"
};
private static object lockObj = new object();

[Flags]
public enum CreateToolhelp32SnapshotFlags : uint
Expand Down Expand Up @@ -1637,7 +1636,7 @@ private static string GetProcessNameFromIdInternal(uint pid)
}
finally
{
sbProcName.Clear();
_ = sbProcName?.Clear();
sbProcName = null;
hProc?.Dispose();
hProc = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ private float GetProcessMemoryMbPerfCounter(string procName, int procId, Cancell
return 0F;
}
}
catch (Win32Exception ex)
catch (Win32Exception ex) // Doesn't throw this anymore. Change this in (3.2.8).
{
// The related Observer will have logged any privilege related failure.
if (ex.NativeErrorCode != 5)
Expand Down Expand Up @@ -614,7 +614,7 @@ private static string GetInternalProcessName(string procName, int pid, Cancellat
return null;
}

// TODO: Don't use Process here. Consider caching SF user service proc list in AppObserver. Pass a ref to the list to this function..
// TODO: Don't use .net Process here. Write a new NativeMethods function to do this with less overhead, with less CPU. (3.2.8)
int procCount = Process.GetProcessesByName(procName).Length;

if (procCount == 1)
Expand Down Expand Up @@ -659,17 +659,7 @@ private static string GetInternalProcNameFromId(string procName, int pid, Cancel
string instanceName = InstanceNameDictionary[pid].instanceName;
DateTime processStartTime = InstanceNameDictionary[pid].processStartTime;

string pName = NativeMethods.GetProcessNameFromId(pid);

if (pName == null)
{
_ = InstanceNameDictionary.TryRemove(pid, out _);
return null;
}

if (InstanceNameDictionary[pid].procName == procName &&
pName == procName &&
NativeMethods.GetProcessStartTime(pid).Equals(processStartTime))
if (InstanceNameDictionary[pid].procName == procName && NativeMethods.GetProcessStartTime(pid).Equals(processStartTime))
{
return InstanceNameDictionary[pid].instanceName;
}
Expand Down
2 changes: 1 addition & 1 deletion FabricObserver.nuspec.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<id>%PACKAGE_ID%</id>
<version>3.2.7</version>
<releaseNotes>
Bug fixes, performance and code improvements.
Bug fixes, several performance and code improvements.
</releaseNotes>
<authors>Microsoft</authors>
<license type="expression">MIT</license>
Expand Down
6 changes: 6 additions & 0 deletions FabricObserver/Observers/FabricSystemObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,12 @@ private void CleanUp()
activeTcpPortData.Value?.ClearData();
}
}

if (fabricSystemProcInfo != null)
{
fabricSystemProcInfo.Clear();
fabricSystemProcInfo = null;
}
}
}
}

0 comments on commit e7f8994

Please sign in to comment.