Skip to content

Commit 4dcfa9d

Browse files
authored
Add Launcher and info on how to load the plugins in the Windows WPA UI (#8)
* Add Launcher and info on how to load the plugins in the Windows WPA UI
1 parent 0acbac2 commit 4dcfa9d

File tree

7 files changed

+168
-1
lines changed

7 files changed

+168
-1
lines changed

Images/ADK_WPT.jpg

60.5 KB
Loading
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:: Copyright (c) Microsoft Corporation.
2+
:: Licensed under the MIT License.
3+
4+
@ECHO OFF
5+
6+
IF "%~1" == "" (
7+
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0\LaunchWpaPerfToolsLinux.ps1"
8+
) ELSE (
9+
IF "%~2" == "" (
10+
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0\LaunchWpaPerfToolsLinux.ps1" -InputFile "%~1"
11+
) ELSE (
12+
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0\LaunchWpaPerfToolsLinux.ps1" -InputFile "%~1" -WpaProfile "%~2"
13+
)
14+
)
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
<#
5+
.Synopsis
6+
Launches WPA UI with the Microsoft-Performance-Tools-Linux plugins
7+
#>
8+
9+
Param(
10+
[parameter(Mandatory=$false)]
11+
[alias("i")]
12+
$InputFile,
13+
[parameter(Mandatory=$false)]
14+
[alias("p")]
15+
$WpaProfile,
16+
[parameter(Mandatory=$false)]
17+
[alias("l")]
18+
$LinuxPerfToolsPluginFolder
19+
)
20+
21+
Write-Host "Please see https://aka.ms/linuxperftools for help"
22+
23+
if (-not $LinuxPerfToolsPluginFolder -or -not (Test-Path -Path $LinuxPerfToolsPluginFolder -ErrorAction Ignore | Out-Null))
24+
{
25+
$scriptPath = Get-Item (Split-Path $MyInvocation.MyCommand.Path -Parent)
26+
$LinuxPerfToolsPluginFolder = $scriptPath.Parent.Parent.FullName
27+
}
28+
Write-Host "Using root folder as:" $LinuxPerfToolsPluginFolder
29+
30+
if ($LinuxPerfToolsPluginFolder)
31+
{
32+
$localLinuxPerfWpaAddins = Join-Path -Path $LinuxPerfToolsPluginFolder -ChildPath "MicrosoftPerfToolkitAddins\LTTngDataExtensions" # TODO - Remove LTTngDataExtensions path to include all plugins - Bug only 1 extension is supported at a time in current ADK DROP"
33+
}
34+
35+
Write-Host "Using plugins folder as:" $localLinuxPerfWpaAddins
36+
37+
if ($LinuxPerfToolsPluginFolder -and -not (Test-Path -Path $localLinuxPerfWpaAddins))
38+
{
39+
Write-Host "Please download the latest release from https://github.com/microsoft/Microsoft-Performance-Tools-Linux/releases"
40+
Start-Process "https://github.com/microsoft/Microsoft-Performance-Tools-Linux/releases"
41+
Pause
42+
Exit
43+
}
44+
45+
$wpaProcess = "C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\wpa.exe"
46+
47+
if (-not (Test-Path -Path $wpaProcess))
48+
{
49+
Write-Host "Please download the latest ADK Preview and install Windows Performance Toolkit"
50+
Start-Process "https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewADK"
51+
Pause
52+
Exit
53+
}
54+
55+
$startInfo = New-Object System.Diagnostics.ProcessStartInfo
56+
$startInfo.FileName = $wpaProcess
57+
58+
if ($InputFile)
59+
{
60+
$paramFile = Get-Item $InputFile -ErrorAction Continue
61+
if ($paramFile.Exists)
62+
{
63+
if ($WpaProfile)
64+
{
65+
$startInfo.Arguments = "-i `"$InputFile`" -profile `"$WpaProfile`" -addsearchdir `"$localLinuxPerfWpaAddins`""
66+
}
67+
else
68+
{
69+
$startInfo.Arguments = "-i `"$InputFile`" -addsearchdir `"$localLinuxPerfWpaAddins`""
70+
}
71+
}
72+
}
73+
else
74+
{
75+
# TODO - Add back in for just launch - Current ADK DROP has bug to not allow launch w/o -i
76+
#$startInfo.Arguments = "-addsearchdir `"$localLinuxPerfWpaAddins`""
77+
Write-Error "Current ADK DROP has bug to not allow launch WPA UI just configured with plugins (use -i and -addsearchdir)"
78+
Pause
79+
Exit
80+
}
81+
82+
Write-Host "Launching" $wpaProcess $startInfo.Arguments
83+
84+
$startInfo.RedirectStandardOutput = $true
85+
$startInfo.UseShellExecute = $false
86+
$startInfo.CreateNoWindow = $false
87+
88+
$process = New-Object System.Diagnostics.Process
89+
$process.StartInfo = $startInfo
90+
$process.Start()
91+
92+
sleep 1
93+
if ($process.HasExited)
94+
{
95+
Write-Host "Process StdOut:"
96+
Write-Host $process.StandardOutput.ReadToEnd()
97+
}
98+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[{000214A0-0000-0000-C000-000000000046}]
2+
Prop3=19,11
3+
[InternetShortcut]
4+
IDList=
5+
URL=https://aka.ms/linuxperftools
6+
HotKey=0

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,35 @@ The tools can be run in several modes:
4242
- With a driver program for example dumping to screen or text format
4343
- ./LTTngDriver.exe LTTng-Kernel-Trace.ctf (trace folder is zipped and renamed to .ctf)
4444
- ./LTTngDriver.exe LTTngKernelTraceFolder (not currently working - blocked on [Issue #6](https://github.com/microsoft/Microsoft-Performance-Tools-Linux/issues/6))
45+
- (Windows Only - Install) Using the WPA GUI to load these tools as plugins
46+
- Download the latest Windows Performance Toolkit (WPT) that comes in the [ADK Preview](https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewADK)
47+
- Note: In the future, the WPA team plans to make it easier to install WPA outside of the ADK
48+
- Install Windows Performance Toolkit ![Windows Performance Toolkit](Images/ADK_WPT.jpg)
49+
- Verify that this WPA version supports plugins
50+
- In Command Prompt
51+
```dos
52+
"C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\wpa.exe" /?
53+
```
54+
- Verify that these 2 command line WPA options are supported:
55+
- OPTIONS: **-addsearchdir PATH**. Adds a directory path to the plugin search path. ....
56+
- ENVIRONMENT VARIABLES: **WPA_ADDITIONAL_SEARCH_DIRECTORIES** - A semicolon (;) delimited list of additional directories to search for plugins. Equivalent to the -addsearchdir option.
57+
- (Windows Only - Run) Using the WPA GUI to load these tools as plugins
58+
- WPA needs to be told where to find these additional plugins.
59+
- Using [Windows Launcher](Launcher/Windows/LaunchWpaPerfToolsLinux.ps1). -LinuxPerfToolsPluginFolder path may need to be specified
60+
```powershell
61+
.\LaunchWpaPerfToolsLinux.ps1 -i c:\PATH\TO\lttng-kernel-trace.ctf
62+
```
63+
- In Command Prompt with -addsearchdir and -i trace file:
64+
```dos
65+
"C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\wpa.exe" -addsearchdir %HOMEDRIVE%%HOMEPATH%\Downloads\Microsoft-Performance-Tools-Linux-0.8\Microsoft-Performance-Tools-Linux\MicrosoftPerfToolkitAddins -i c:\PATH\TO\lttng-kernel-trace.ctf
66+
```
67+
- OR with Env Variable to pick file from UI (Env variable not currently working in current ADK version)
68+
```dos
69+
SET WPA_ADDITIONAL_SEARCH_DIRECTORIES=%HOMEDRIVE%%HOMEPATH%\Downloads\Microsoft-Performance-Tools-Linux-0.8\Microsoft-Performance-Tools-Linux\MicrosoftPerfToolkitAddins
70+
"C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\wpa.exe"
71+
```
72+
4573
- (Coming soon) (Windows) Command-line dumping to a text format (say CSV)
46-
- (Coming soon) (Windows) Using the WPA GUI to load these tools as plugins
4774
4875
# How to capture a trace or logs
4976
Please see [Linux Trace Log Capture](LinuxTraceLogCapture.md)

ReleaseFiles/README.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
This README covers the basics of what's included in this release and how to use/run.
2+
3+
For more detailed help and pre-requisites see https://aka.ms/linuxperftools
4+
5+
└── Microsoft-Performance-Tools-Linux
6+
├── LTTngDriver - Standalone LTTngDriver.exe cross-platform .NET Core program to dump processed LTTng events to stdout or a file
7+
├── Launcher - Launches WPA UI configured to point at these additional Linux plugins
8+
└── MicrosoftPerfToolkitAddins - The actual various plugins each self-contained per sub-folder

azure-pipelines.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,20 @@ jobs:
113113
SourceFolder: 'LinuxLogParsers/LinuxPlugins-MicrosoftPerformanceToolkSDK/WaLinuxAgent/bin/$(BuildConfiguration)/netstandard2.1'
114114
Contents: '**'
115115
TargetFolder: '$(Build.ArtifactStagingDirectory)/Microsoft-Performance-Tools-Linux/MicrosoftPerfToolkitAddins/WaLinuxAgent'
116+
117+
- task: CopyFiles@2
118+
displayName: Copy Launcher
119+
inputs:
120+
SourceFolder: 'Launcher'
121+
Contents: '**'
122+
TargetFolder: '$(Build.ArtifactStagingDirectory)/Microsoft-Performance-Tools-Linux/Launcher'
123+
124+
- task: CopyFiles@2
125+
displayName: Copy Extra Release Files
126+
inputs:
127+
SourceFolder: 'ReleaseFiles'
128+
Contents: '**'
129+
TargetFolder: '$(Build.ArtifactStagingDirectory)/Microsoft-Performance-Tools-Linux'
116130

117131
- task: PublishBuildArtifacts@1
118132
inputs:

0 commit comments

Comments
 (0)