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

Tracing improvements #50

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "0.64.11",
"version": "0.64.12",
"v8ref": "refs/branch-heads/9.0"
}
40 changes: 30 additions & 10 deletions scripts/tracing/trace.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
.PARAMETER SessionName
Include this paramter if the trace session name needs to be overriden.

.PARAMETER OutputPath
None.

.INPUTS
None. You cannot pipe objects to this script.

Expand All @@ -34,8 +31,8 @@
[CmdletBinding()]
Param(
[Parameter(ParameterSetName='Default', Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[switch]$NoFormatting,
[switch]$IncludeInspectorTraces,
[switch]$Chatty,
[String]$SessionName = 'V8TraceSession'
)

Expand Down Expand Up @@ -102,10 +99,30 @@ process {
Import-Module (Join-Path $vsInstallPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
Enter-VsDevShell -VsInstallPath $vsInstallPath -SkipAutomaticLocation

$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
$timestamp = [DateTime]::Now.ToString("yyyyMMdd_HHmmss")
$fileName = "rnw_" + $timestamp + ".etl"
$etlPath = Join-Path -Path $scriptPath -ChildPath $fileName

# These guids should match the TraceLog provider definition in code.
$traceLogStartCmd = "tracelog -start $SessionName -guid #85A99459-1F1D-49BD-B3DC-E5EF2AD0C2C8 -rt"
$traceLogStartCmd = "tracelog -start $SessionName -guid #85A99459-1F1D-49BD-B3DC-E5EF2AD0C2C8 -rt -f $etlPath"
$traceLogEnableInspectorCmd = "tracelog -enable $SessionName -guid #5509957C-25B6-4294-B2FA-8A8E41E6BC37"
$traceLogDisplayCmd = "tracefmt -rt $SessionName -displayonly"
$traceLogEnableReactNativeSystraceCmd = "tracelog -enable $SessionName -guid #910FB9A1-75DD-4CF4-BEEC-DA21341F20C8"

$traceFmtCmd = "tracefmt -rt $SessionName"
$WriteFormattedToFile = $False
if(!$WriteFormattedToFile) {
$traceFmtCmd = $traceFmtCmd + " -displayonly"
} else {
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
$timestamp = [DateTime]::Now.ToString("yyyyMMdd_HHmmss")
$outFileName = "trace_" + $timestamp + ".txt"
$outFilePath = Join-Path -Path $scriptPath -ChildPath $outFileName

$traceFmtCmd = $traceFmtCmd + " -o $outFilePath"
Write-Host "Writing formatted traces to $outFilePath ... \n"
}

$traceLogStopCmd = "tracelog -stop $SessionName"

$traceLogCmd = $traceLogStartCmd
Expand All @@ -114,12 +131,15 @@ process {
$traceLogCmd = $traceLogCmd + " & $traceLogEnableInspectorCmd"
}

$traceLogCmd = $traceLogCmd + " & $traceLogDisplayCmd"
$traceLogCmd = $traceLogCmd + " & $traceLogEnableReactNativeSystraceCmd"

if(!$NoFormatting.IsPresent) {
$traceLogCmd = $traceLogCmd + " & $traceFmtCmd"
}

$traceLogCmd = $traceLogCmd + " & $traceLogStopCmd"

Write-Host $traceLogCmd
Write-Host -NoNewLine 'Press Ctrl+C to stop collection ...';
cmd /c "$traceLogCmd & pause"

Write-Host -NoNewLine 'Press any key to continue...';
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
}
Loading