Skip to content

Commit 7058046

Browse files
Merge branch 'release/1.0.1'
2 parents a97c51e + 3f15a1f commit 7058046

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

ProcessPerformance/PerformanceReporter.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ private class Counters
6565
}
6666

6767
public PerformanceReporter(String[] processNames, string networkIP = null)
68-
{
68+
{
69+
6970
if (processNames.Length == 0)
7071
{
7172
_processList = () => { return Process.GetProcesses().Select(p => p.Id).ToHashSet(); };
@@ -76,7 +77,11 @@ public PerformanceReporter(String[] processNames, string networkIP = null)
7677
{
7778
return processNames.Aggregate(new List<int>(), (partial, processName) =>
7879
{
79-
partial.AddRange(Process.GetProcessesByName(processName).Select(p => p.Id)); return partial;
80+
partial.AddRange(Process.GetProcesses().Where(
81+
p => p.MainWindowTitle.ToLower().Contains(processName.ToLower())
82+
|| p.ProcessName.ToLower().Contains(processName.ToLower())
83+
|| p.Id.ToString().Equals(processName)
84+
).Select(p => p.Id)); return partial;
8085
}).ToHashSet();
8186
};
8287
}
@@ -98,7 +103,7 @@ private void StartEtwSession()
98103

99104
using (_etwSession = new TraceEventSession("KernelTcpIpEventsSession"))
100105
{
101-
_etwSession.EnableKernelProvider(KernelTraceEventParser.Keywords.All);
106+
_etwSession.EnableKernelProvider(KernelTraceEventParser.Keywords.NetworkTCPIP);
102107
_etwSession.Source.Kernel.TcpIpRecv += data =>
103108
{
104109
if (_processList().Contains(data.ProcessID))

ProcessPerformance/ProcessPerformance.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>

ProcessPerformance/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ private static Parameters ParseArguments(string[] args)
8080
}
8181
}
8282

83-
public const string HELP_MESSAGE = "ProcessPerformance 2020 Computational Reflection Research Group\n" +
83+
public const string HELP_MESSAGE = "ProcessPerformance 2021 Computational Reflection Research Group\n" +
8484
"-help Displays this usage message.\n" +
8585
"-network:NETWORK_IP Specify the network interface IP (disable by default).\n" +
8686
"-interval:MILISENCONS Specify the interval time in milisecons (default is 1000).\n" +
8787
"-csv Specify output format as CSV (disable by default).\n" +
88-
"process_1 ... process_n A list of process names (if empty, all running processes are used).\n" +
88+
"process_1 ... process_n A list of process names or PIDs (if empty, all running processes are used).\n" +
8989
"\nCtrl + c Is the interrupt signal.\n" +
9090
"\n";
9191
}

ProcessPerformance/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"ProcessPerformance": {
44
"commandName": "Project",
5-
"commandLineArgs": "chrome teams -network:192.168.1.103"
5+
"commandLineArgs": "chrome tomcat neo4j postgres -network:192.168.1.103 -interval:500"
66
}
77
}
88
}

0 commit comments

Comments
 (0)