Skip to content

Commit e3df894

Browse files
authored
Merge pull request #393 from vancem/WindowsContainerSupport.9-27-17
Added support for Windows Containers.
2 parents 713814e + d944e9b commit e3df894

File tree

10 files changed

+118
-87
lines changed

10 files changed

+118
-87
lines changed

src/PerfView/App.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public static int Main(string[] args)
4747
{
4848
// Can't display on ARM because the SplashScreen is WPF
4949
var noGui = SupportFiles.ProcessArch == ProcessorArchitecture.Arm ||
50-
(args.Length > 0 && string.Compare(args[0], "/noGui", StringComparison.OrdinalIgnoreCase) == 0);
50+
(args.Length > 0 &&
51+
(string.Compare(args[0], "/noGui", StringComparison.OrdinalIgnoreCase) == 0 ||
52+
string.Compare(args[0], 0, "/logFile", 0, 8, StringComparison.OrdinalIgnoreCase) == 0));
5153

5254
// If we need to install, display the splash screen early, otherwise wait
5355
if (!Directory.Exists(SupportFiles.SupportFileDir) && !noGui)
@@ -798,8 +800,9 @@ private static void CloseSplashScreen()
798800
if (s_splashScreen != null)
799801
{
800802
var splashScreen = (SplashScreen)s_splashScreen.Target;
801-
splashScreen.Close(new TimeSpan(0));
802803
s_splashScreen = null;
804+
if (splashScreen != null)
805+
splashScreen.Close(new TimeSpan(0));
803806
}
804807
}
805808
private static WeakReference s_splashScreen;

src/PerfView/OtherSources/Linux/LinuxPerfScriptStackSource.cs

+9-4
Original file line numberDiff line numberDiff line change
@@ -409,24 +409,29 @@ private StackSourceCallStackIndex InternFrames(IEnumerator<Frame> frameIterator,
409409
private Stream GetPerfScriptStream(string path, out ZipArchive archive)
410410
{
411411
archive = null;
412-
if (path.EndsWith(".trace.zip"))
412+
if (path.EndsWith(".trace.zip", StringComparison.OrdinalIgnoreCase))
413413
{
414414
archive = ZipFile.OpenRead(path);
415415
ZipArchiveEntry foundEntry = null;
416416

417417
foreach (ZipArchiveEntry entry in archive.Entries)
418418
{
419-
if (entry.FullName.EndsWith(".data.txt"))
419+
if (entry.FullName.EndsWith(".data.txt", StringComparison.OrdinalIgnoreCase))
420420
{
421421
foundEntry = entry;
422422
break;
423423
}
424424
}
425425

426-
return foundEntry?.Open();
426+
if (foundEntry == null)
427+
throw new ApplicationException($"file {path} is does not have a *.data.txt file inside.");
428+
429+
return foundEntry.Open();
427430
}
428-
else
431+
else if (path.EndsWith(".data.txt", StringComparison.OrdinalIgnoreCase) || path.EndsWith(".perf.data.dump", StringComparison.OrdinalIgnoreCase))
429432
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
433+
else
434+
throw new ApplicationException($"file {path} is not a *.trace.zip *.data.txt or a *.perf.data.dump suffix.");
430435
}
431436

432437
private double? SampleEndTime;

src/PerfView/PerfView.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Description>PerfView</Description>
1212
<Company>Microsoft</Company>
1313
<Copyright>Copyright © Microsoft 2010</Copyright>
14-
<FileVersion>1.9.62.0</FileVersion>
14+
<FileVersion>1.9.64.0</FileVersion>
1515
</PropertyGroup>
1616

1717
<ItemGroup>

src/PerfView/PerfViewData.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5844,7 +5844,7 @@ protected override Action<Action> OpenImpl(Window parentWindow, StatusBar worker
58445844
{
58455845
obsolete.Children.Add(new PerfViewStackSource(this, "ASP.NET Thread Time (with Tasks)"));
58465846
}
5847-
else
5847+
else if (!hasCSwitchStacks)
58485848
name += " (CPU ONLY)";
58495849
obsolete.Children.Add(new PerfViewStackSource(this, name));
58505850
}

src/PerfView/SupportFiles/UsersGuide.htm

+15
Original file line numberDiff line numberDiff line change
@@ -8045,6 +8045,21 @@ <h2>
80458045
</ul>
80468046
</li>
80478047
-->
8048+
<li>
8049+
Version 1.9.64 9/27/17
8050+
<ul>
8051+
<li>
8052+
Added Support for Argon (light weight) Windows containers. Most of this is in fact work-arounds which
8053+
will eventually be removed, but this makes PerfView work with Argon containers in the RS3 version of the OS
8054+
(the version currently available). Note that there seems to still be issues with looking up symbols for SOME
8055+
OS DLLs, but all managed code should work. Also PerfView is a GUI app and Argon containers don't use
8056+
gui, so you need to use the techniques in 'Automating data collection' to use perfView in the container.
8057+
(for example 'Perfview.exe /logfile:logfile.txt /accepteula /maxcollectsec:30 collect'). PerfView (like
8058+
all gui apps) will run in the background if run from the command line directly, but will block until exit
8059+
when run from a batch script).
8060+
</li>
8061+
</ul>
8062+
</li>
80488063
<li>
80498064
Version 1.9.55 5/9/17
80508065
<ul>

src/TraceEvent/Parsers/KernelTraceEventParser.cs

+21
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ public enum Keywords
190190
| SystemCall // Interesting but very expensive.
191191
| OS,
192192

193+
/// <summary>
194+
/// These are the kernel events that are not allowed in containers. Can be subtracted out.
195+
/// </summary>
196+
NonContainer = ~(Process | Thread | ImageLoad | Profile | ContextSwitch),
197+
193198
// These are ones that I have made up
194199
// All = 0x07B3FFFF, so 4'0000, 8'0000, 40'0000, and F000'00000 are free.
195200
/// <summary>
@@ -3409,6 +3414,22 @@ public string this[string kernelName]
34093414
if (kernelToDriveMap.Count == 0)
34103415
PopulateFromLocalMachine();
34113416

3417+
#if !CONTAINER_WORKAROUND_NOT_NEEDED
3418+
// Currently ETW shows paths from the HOST not the CLIENT for some files. We recognise them
3419+
// because they have have the form of a GUID path \Files and then the client path. We only
3420+
// need to fix this for windows (OS) files, so we use \Files\Windows\as the key that this is
3421+
// happening, and we morph the name to fix it.
3422+
3423+
// We can pull this out when the OS fixes ETW to show client names.
3424+
var filesIdx = kernelName.IndexOf(@"\Files\Windows\", StringComparison.OrdinalIgnoreCase);
3425+
if (16 < filesIdx)
3426+
{
3427+
var ret = systemDrive + kernelName.Substring(filesIdx + 6);
3428+
return ret;
3429+
}
3430+
3431+
#endif
3432+
34123433
for (int i = 0; i < kernelToDriveMap.Count; i++)
34133434
{
34143435
Debug.Assert(kernelToDriveMap[i].Key.EndsWith(@"\"));

0 commit comments

Comments
 (0)