Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiagofe Perfmon counter translation #171

Merged
Prev Previous commit
Next Next commit
Full working version attempt
Improved some performance .
added the new ps1 process and removed diagutil.exe call
added file to project
  • Loading branch information
tiagodiasfernandes committed May 20, 2022
commit 76f825bb917ff88fa1718dc27770ca2a92ed44a8
3 changes: 3 additions & 0 deletions DiagManager/DiagManager.csproj
Original file line number Diff line number Diff line change
@@ -493,6 +493,9 @@
<Content Include="Pristine\pssdiag.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Pristine\perfmon_translate.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
11 changes: 6 additions & 5 deletions DiagManager/Pristine/perfmon_translate.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#Check if the language is not English
if((Get-WinSystemLocale).name -notlike "en*"){

#revert xml file to original En language
Copy-Item -Path C:\perfmon_test\org\pssdiag.xml -Destination C:\perfmon_test\pssdiag.xml
#Get all Local existing counters paths in array for future check
$counterexistingpaths = @(Get-Counter -ListSet *).Paths

#Get performance counters names and ID's in english and local languages to hash table
$pc_en_names = [Microsoft.Win32.Registry]::PerformanceData.GetValue("Counter 009")
@@ -40,7 +40,7 @@ if((Get-WinSystemLocale).name -notlike "en*"){


#get pssdiag xml with performance counters info
$pathxml = "C:\perfmon_test\pssdiag.xml"
$pathxml = "pssdiag.xml"
$xml = [xml](Get-Content $pathxml)


@@ -114,7 +114,7 @@ if((Get-WinSystemLocale).name -notlike "en*"){
$dup_node_name = $pc_local_hash."$dup_node"
$confirm_counter = $pob_translated_name + "\" + $dup_node_name

IF ((@(Get-Counter -ListSet $pob_local_name).Paths).Contains($confirm_counter)){
IF ($counterexistingpaths.Contains($confirm_counter)){
$pc_local_name = $dup_node_name
}
}
@@ -139,5 +139,6 @@ if((Get-WinSystemLocale).name -notlike "en*"){


#save the XML file with the changes
$xml.Save("C:\perfmon_test\pssdiag.xml")
$xmlsavelocation = (Get-Location).Path + "\" + $pathxml
$xml.Save($xmlsavelocation)
}
5 changes: 2 additions & 3 deletions DiagManager/Pristine/pssdiag.ps1
Original file line number Diff line number Diff line change
@@ -405,9 +405,8 @@ function main
}


#call diagutil.exe 1 for now until counter translation is implemented in this script
Write-Host "Executing: diagutil.exe 1"
Start-Process -FilePath "diagutil.exe" -ArgumentList "1" -WindowStyle Normal
#Translate Performance Counters if((Get-WinSystemLocale).name -notlike "en*")
& .\perfmon_translate.ps1

# launch the sqldiag.exe process
Write-Host "Executing: $sqldiag_path $argument_list"