In the current implementation, the current dotnet-trace collect -- hides all details of the executed application from the user of dotnet-trace. This is problematic in several ways, and while the --diagnostic-port switch can be used to workaround this limitation, I believe the current model is much less useable than it could be.
Background and Motivation
I am researching ways to build a profile guided optimization experience based on trace data. The basic approach is to build an application, measure and run a training scenario, and then rebuild the application with the training data. To make this approach efficient to work on, I need to build a set of scripts that will perform the various build and analysis operations. I've reached for the dotnet-trace tool as part of this workflow, in order to capture information about the training process.
I ran into several issues with using dotnet-trace as a tool in this process.
- Documentation for the -- switch is only present in docs.microsoft.com, and is not present from the application command line help.
- When I attempted to run my training application, I was unable to tell that it was actually crashing every time it ran it without quite a lot of effort. (I needed to use child process debugging with windbg to find this). While the actual crash was not the fault of dotnet-trace, the UX of dotnet-trace for child process work made it impractical to diagnose this issue efficiently.
- Furthermore, when I attempted to use this tool on an ASP.NET process, I was unable to, as the tool captured the Ctrl-C handler which I intended to use to extra the ASP.NET process in a clean fashion. (This is less of a concern, now that I am aware of the
--diagnostic-port switch.)
In addition to the above, the expected use of the profile guided optimization feature is that application developers will build a CI system uses dotnet-trace in the midst of every build to profile the product as part of their build process.
The suggested approach will look like the following...
- Build the product with dotnet build
- Run the newly built product under a series of training scenarios. These executions would be done via something like dotnet-trace --.
- For console applications this is a very simple process
- For ASP.NET applications, this is more complicated. I suspect we could probably structure the tests to be unittests runnable from the command line, but this may be an unreasonable expectation.
- After generating traces, take them and feed them through the dotnet-pgo tool to produce a set of instrumentation data.
- Rebuild the product with a special build that uses the instrumentation data.
In these cases, it is important that the training scenario test case output and behavior are straightforward to dump into the output.
Proposed Feature
Add a switch to dotnet-trace which can be used in combination with -- to generate a full set of output (and possibly) input from the child process. This is a better approach for scripting and some interactive uses as it allows the process to avoid the need for multiple windows, and complex parallel process orchestration. In addition to not hiding the output from the process, it would reduce/eliminate the periodic progress reports from the tool.
- My proposed name for this switch is
--redirect-child-output:false
In addition, the exit code from the process is valuable, and should become the exit code from the dotnet-trace tool. This allows scripts to easily detect failure, and mark a CI leg as failed.
Usage Examples
See Background...
In the current implementation, the current
dotnet-trace collect --hides all details of the executed application from the user of dotnet-trace. This is problematic in several ways, and while the--diagnostic-portswitch can be used to workaround this limitation, I believe the current model is much less useable than it could be.Background and Motivation
I am researching ways to build a profile guided optimization experience based on trace data. The basic approach is to build an application, measure and run a training scenario, and then rebuild the application with the training data. To make this approach efficient to work on, I need to build a set of scripts that will perform the various build and analysis operations. I've reached for the dotnet-trace tool as part of this workflow, in order to capture information about the training process.
I ran into several issues with using
dotnet-traceas a tool in this process.--diagnostic-portswitch.)In addition to the above, the expected use of the profile guided optimization feature is that application developers will build a CI system uses dotnet-trace in the midst of every build to profile the product as part of their build process.
The suggested approach will look like the following...
In these cases, it is important that the training scenario test case output and behavior are straightforward to dump into the output.
Proposed Feature
Add a switch to
dotnet-tracewhich can be used in combination with--to generate a full set of output (and possibly) input from the child process. This is a better approach for scripting and some interactive uses as it allows the process to avoid the need for multiple windows, and complex parallel process orchestration. In addition to not hiding the output from the process, it would reduce/eliminate the periodic progress reports from the tool.--redirect-child-output:falseIn addition, the exit code from the process is valuable, and should become the exit code from the dotnet-trace tool. This allows scripts to easily detect failure, and mark a CI leg as failed.
Usage Examples
See Background...