Repository: spaghettidba/WorkloadTools
Branch: master
Commit: 9fab260e2d4e
Files: 176
Total size: 904.9 KB
Directory structure:
gitextract_79qcbrcm/
├── .config/
│ └── dotnet-tools.json
├── .editorconfig
├── .gitattributes
├── .gitignore
├── ConvertWorkload/
│ ├── App.config
│ ├── ConvertWorkload.csproj
│ ├── EventReader.cs
│ ├── EventWriter.cs
│ ├── ExtendedEventsEventReader.cs
│ ├── LocalDBManager.cs
│ ├── NLog.config
│ ├── Program.cs
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ ├── SqlTraceEventReader.cs
│ ├── WorkloadConverter.cs
│ ├── WorkloadFileEventWriter.cs
│ └── packages.config
├── DebuggingTools/
│ ├── capture.json
│ ├── capture_trace.json
│ ├── capture_xel.json
│ ├── generate-allWorkload.bat
│ ├── generate-workload.ps1
│ ├── replay.json
│ ├── report.bat
│ ├── setup.bat
│ ├── start-capture.bat
│ ├── start-capture_trace.bat
│ ├── start-capture_xel.bat
│ └── start-replay.bat
├── LICENSE.md
├── README.md
├── Reports/
│ ├── README.md
│ ├── WorkloadTools Report - Sample.pbix
│ └── WorkloadTools Report - Template.pbit
├── Setup/
│ ├── Product.wxs
│ ├── Setup.wixproj
│ ├── SignMsi.ps1
│ ├── buildmsi.ps1
│ ├── postbuild.bat
│ ├── transform-nodirs.xsl
│ ├── transform.xsl
│ ├── transform2.xsl
│ └── transform3.xsl
├── SetupBootstrapper/
│ ├── Bundle.wxs
│ ├── License/
│ │ └── License.rtf
│ ├── SetupBootstrapper.wixproj
│ ├── SignMsi.ps1
│ ├── buildexe.ps1
│ └── postbuild.bat
├── SharedAssemblyInfo.cs
├── SqlWorkload/
│ ├── NLog.config
│ ├── Program.cs
│ ├── Properties/
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── SqlWorkload.csproj
│ ├── app.config
│ └── packages.config
├── WorkloadTools/
│ ├── BinarySerializedBufferedEventQueue.cs
│ ├── BufferedEventQueue.cs
│ ├── Config/
│ │ ├── AnalysisSample.json
│ │ ├── ReplaySample.json
│ │ ├── Sample.json
│ │ ├── SqlWorkloadConfig.cs
│ │ └── SqlWorkloadConfigTypeResolver.cs
│ ├── Consumer/
│ │ ├── Analysis/
│ │ │ ├── AnalysisConsumer.cs
│ │ │ ├── DatabaseSchema.sql
│ │ │ ├── NormalizedSqlText.cs
│ │ │ ├── SqlTextNormalizer.cs
│ │ │ ├── WorkloadAnalyzer.cs
│ │ │ └── createAnalysisView.sql
│ │ ├── BufferedWorkloadConsumer.cs
│ │ ├── Replay/
│ │ │ ├── ReplayCommand.cs
│ │ │ ├── ReplayConsumer.cs
│ │ │ ├── ReplayWorker.cs
│ │ │ ├── ReplayWorker.cs.bak
│ │ │ └── ResultSetConsumer.cs
│ │ ├── WorkloadConsumer.cs
│ │ └── WorkloadFile/
│ │ └── WorkloadFileWriterConsumer.cs
│ ├── CounterWorkloadEvent.cs
│ ├── DiskPerfWorkloadEvent.cs
│ ├── ErrorWorkloadEvent.cs
│ ├── ExecutionWorkloadEvent.cs
│ ├── FilterPredicate.cs
│ ├── GlobalSuppressions.cs
│ ├── IEventQueue.cs
│ ├── Listener/
│ │ ├── ExtendedEvents/
│ │ │ ├── ExtendedEventsEventFilter.cs
│ │ │ ├── ExtendedEventsFilterPredicate.cs
│ │ │ ├── ExtendedEventsWorkloadListener.cs
│ │ │ ├── FileTargetXEventDataReader.cs
│ │ │ ├── StreamXEventDataReader.cs
│ │ │ ├── XEventDataReader.cs
│ │ │ └── sqlworkload.sql
│ │ ├── File/
│ │ │ ├── FileEventFilter.cs
│ │ │ ├── FileFilterPredicate.cs
│ │ │ └── FileWorkloadListener.cs
│ │ ├── ReadIteration.cs
│ │ ├── SqlTransformer.cs
│ │ └── Trace/
│ │ ├── FileTraceEventDataReader.cs
│ │ ├── ProfilerEventFilter.cs
│ │ ├── ProfilerFilterPredicate.cs
│ │ ├── ProfilerWorkloadListener.cs
│ │ ├── SqlConnectionInfoWrapper.cs
│ │ ├── SqlTraceWorkloadListener.cs
│ │ ├── TraceEventDataReader.cs
│ │ ├── TraceEventFilter.cs
│ │ ├── TraceEventParser.cs
│ │ ├── TraceFileWrapper.cs
│ │ ├── TraceFilterPredicate.cs
│ │ ├── TraceServerWrapper.cs
│ │ ├── TraceUtils.cs
│ │ ├── sqlworkload.sql
│ │ └── sqlworkload.tdf
│ ├── MMFEventQueue.cs
│ ├── MessagWorkloadEvent.cs
│ ├── Properties/
│ │ ├── AssemblyInfo.cs
│ │ ├── Settings.Designer.cs
│ │ ├── Settings.settings
│ │ └── SharedAssemblyInfo.cs
│ ├── SqlConnectionInfo.cs
│ ├── SqliteEventQueue.cs
│ ├── Util/
│ │ ├── DataUtils.cs
│ │ ├── ModelConverter.cs
│ │ ├── RingBuffer.cs
│ │ └── StringExtensions.cs
│ ├── WaitStatsWorkloadEvent.cs
│ ├── WorkloadController.cs
│ ├── WorkloadEvent.cs
│ ├── WorkloadEventFilter.cs
│ ├── WorkloadListener.cs
│ ├── WorkloadTools.csproj
│ ├── app.config
│ └── packages.config
├── WorkloadTools.sln
├── WorkloadToolsTests/
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ ├── WorkloadTools/
│ │ ├── BinarySerializedBufferedEventQueueTest.cs
│ │ └── SqlTextNormalizerTest.cs
│ ├── WorkloadToolsTests.csproj
│ ├── app.config
│ └── packages.config
├── WorkloadViewer/
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Comparer/
│ │ └── QueryResultEqualityComparer.cs
│ ├── Model/
│ │ ├── NormalizedQuery.cs
│ │ ├── QueryDetails.cs
│ │ ├── SqlConnectionInfo.cs
│ │ ├── WorkloadAnalysis.cs
│ │ └── WorkloadAnalysisPoint.cs
│ ├── NLog.config
│ ├── Properties/
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── Resources/
│ │ ├── TSQL.xshd
│ │ └── WorkloadAnalysis.sql
│ ├── View/
│ │ ├── ConnectionInfoDialog.xaml
│ │ ├── ConnectionInfoDialog.xaml.cs
│ │ ├── ConnectionInfoDialogStyle.xaml
│ │ ├── ConnectionInfoEditor.xaml
│ │ ├── ConnectionInfoEditor.xaml.cs
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ ├── ViewModel/
│ │ ├── ConnectionInfoEditorViewModel.cs
│ │ ├── DictionaryExtensions.cs
│ │ ├── FilterDefinition.cs
│ │ ├── LinqExtensions.cs
│ │ ├── MainViewModel.cs
│ │ ├── Message.cs
│ │ ├── QueryResult.cs
│ │ ├── SortColMessage.cs
│ │ └── ViewModelLocator.cs
│ ├── WorkloadViewer.csproj
│ └── packages.config
└── build.ps1
================================================
FILE CONTENTS
================================================
================================================
FILE: .config/dotnet-tools.json
================================================
{
"version": 1,
"isRoot": true,
"tools": {
"wix": {
"version": "4.0.5",
"commands": [
"wix"
]
}
}
}
================================================
FILE: .editorconfig
================================================
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4
# New line preferences
end_of_line = crlf
insert_final_newline = false
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = true
dotnet_sort_system_directives_first = true
file_header_template = unset
# this. and Me. preferences
dotnet_style_qualification_for_event = false
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false
dotnet_style_qualification_for_property = false
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members
# Expression-level preferences
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true
dotnet_style_explicit_tuple_names = true
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true
dotnet_style_object_initializer = true
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_compound_assignment = true
dotnet_style_prefer_conditional_expression_over_assignment = true
dotnet_style_prefer_conditional_expression_over_return = true
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
dotnet_style_prefer_inferred_anonymous_type_member_names = true
dotnet_style_prefer_inferred_tuple_names = true
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
dotnet_style_prefer_simplified_boolean_expressions = true
dotnet_style_prefer_simplified_interpolation = true
# Field preferences
dotnet_style_readonly_field = true
# Parameter preferences
dotnet_code_quality_unused_parameters = all
# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none
# New line preferences
dotnet_style_allow_multiple_blank_lines_experimental = true
dotnet_style_allow_statement_immediately_after_block_experimental = true
#### C# Coding Conventions ####
# var preferences
csharp_style_var_elsewhere = true:warning
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
# Expression-bodied members
csharp_style_expression_bodied_accessors = when_on_single_line:warning
csharp_style_expression_bodied_constructors = when_on_single_line:silent
csharp_style_expression_bodied_indexers = when_on_single_line:warning
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
csharp_style_expression_bodied_local_functions = when_on_single_line:warning
csharp_style_expression_bodied_methods = when_on_single_line:silent
csharp_style_expression_bodied_operators = when_on_single_line:warning
csharp_style_expression_bodied_properties = when_on_single_line:warning
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:error
csharp_style_pattern_matching_over_is_with_cast_check = true:error
csharp_style_prefer_extended_property_pattern = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_prefer_switch_expression = true:warning
# Null-checking preferences
csharp_style_conditional_delegate_call = true:warning
# Modifier preferences
csharp_prefer_static_local_function = true:warning
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
csharp_style_prefer_readonly_struct = true:warning
csharp_style_prefer_readonly_struct_member = true:warning
# Code-block preferences
csharp_prefer_braces = true:warning
csharp_prefer_simple_using_statement = false:warning
csharp_style_namespace_declarations = block_scoped:warning
csharp_style_prefer_method_group_conversion = true:suggestion
csharp_style_prefer_top_level_statements = false:suggestion
# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:warning
csharp_style_prefer_range_operator = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_throw_expression = false:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:warning
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:suggestion
# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case
[*.{cs,vb}]
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_readonly_field = true:warning
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
dotnet_code_quality_unused_parameters = all:error
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
================================================
FILE: .gitattributes
================================================
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
.nuget/nuget.exe
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
harvest.wxs
harvest2.wxs
harvest3.wxs
Setup/SignParams.ps1
SetupBootstrapper/SignParams.ps1
*.wixobj.nuget/nuget.exe
*.wixobj
================================================
FILE: ConvertWorkload/App.config
================================================
================================================
FILE: ConvertWorkload/ConvertWorkload.csproj
================================================
Debug
AnyCPU
{62E37C03-BA08-46CE-A583-D71FB7A8825B}
Exe
ConvertWorkload
ConvertWorkload
v4.8
512
false
true
AnyCPU
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
false
AnyCPU
pdbonly
true
bin\Release\
TRACE
prompt
4
false
TRACE;DEBUG
AnyCPU
bin\Debug\
false
bin\Release\
false
TRACE
true
bin\Release\
false
TRACE
true
bin\Debug\
..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll
..\packages\NLog.4.4.12\lib\net45\NLog.dll
..\packages\System.Data.SQLite.Core.1.0.112.0\lib\net46\System.Data.SQLite.dll
Properties\SharedAssemblyInfo.cs
Designer
Always
{ae6e4548-8c33-4728-8504-88aa9666020b}
WorkloadTools
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
================================================
FILE: ConvertWorkload/EventReader.cs
================================================
using System;
using WorkloadTools;
namespace ConvertWorkload
{
public abstract class EventReader : IDisposable
{
private WorkloadEventFilter _filter;
public string[] ApplicationFilter { get; set; }
public string[] DatabaseFilter { get; set; }
public string[] HostFilter { get; set; }
public string[] LoginFilter { get; set; }
protected bool stopped;
protected IEventQueue Events;
protected WorkloadEventFilter Filter
{
get
{
if (_filter != null)
{
_filter.ApplicationFilter.PredicateValue = ApplicationFilter;
_filter.DatabaseFilter.PredicateValue = DatabaseFilter;
_filter.HostFilter.PredicateValue = HostFilter;
_filter.LoginFilter.PredicateValue = LoginFilter;
return _filter;
}
else
{
return null;
}
}
set
{
_filter = value;
}
}
public abstract bool HasFinished();
public abstract WorkloadEvent Read();
public abstract bool HasMoreElements();
public void Dispose()
{
stopped = true;
Events.Dispose();
Dispose(true);
GC.SuppressFinalize(this);
}
protected abstract void Dispose(bool disposing);
}
}
================================================
FILE: ConvertWorkload/EventWriter.cs
================================================
using System;
using WorkloadTools;
namespace ConvertWorkload
{
public abstract class EventWriter : IDisposable
{
protected bool stopped;
public abstract void Write(WorkloadEvent evt);
public void Dispose()
{
stopped = true;
Dispose(true);
GC.SuppressFinalize(this);
}
protected abstract void Dispose(bool disposing);
}
}
================================================
FILE: ConvertWorkload/ExtendedEventsEventReader.cs
================================================
using NLog;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WorkloadTools;
using WorkloadTools.Listener;
using WorkloadTools.Listener.ExtendedEvents;
using WorkloadTools.Util;
namespace ConvertWorkload
{
public class ExtendedEventsEventReader : EventReader
{
private static Logger logger = LogManager.GetCurrentClassLogger();
private string filePath;
private bool started = false;
private bool finished = false;
private FileTargetXEventDataReader reader;
public ExtendedEventsEventReader(string path)
{
Events = new BinarySerializedBufferedEventQueue();
Events.BufferSize = 10000;
filePath = path;
Filter = new ExtendedEventsEventFilter();
}
private void ReadEventsFromFile()
{
try
{
var info = new SqlConnectionInfo();
info.ServerName = "(localdb)\\MSSQLLocalDB";
var sqlCreateTable = @"
IF OBJECT_ID('tempdb.dbo.trace_reader_queue') IS NULL
BEGIN
CREATE TABLE tempdb.dbo.trace_reader_queue (
ts datetime DEFAULT GETDATE(),
path nvarchar(4000)
)
END
TRUNCATE TABLE tempdb.dbo.trace_reader_queue;
INSERT INTO tempdb.dbo.trace_reader_queue (path) VALUES(@path);
";
using (var conn = new SqlConnection())
{
conn.ConnectionString = info.ConnectionString();
conn.Open();
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = sqlCreateTable;
var prm = new SqlParameter()
{
ParameterName = "@path",
DbType = System.Data.DbType.String,
Size = 4000,
Value = filePath
};
cmd.Parameters.Add(prm);
cmd.ExecuteNonQuery();
}
}
reader = new FileTargetXEventDataReader(info.ConnectionString(), null, Events, ExtendedEventsWorkloadListener.ServerType.LocalDB);
reader.ReadEvents();
finished = true;
}
catch (Exception ex)
{
logger.Error(ex.Message);
if (ex.InnerException != null)
{
logger.Error(ex.InnerException.Message);
}
Dispose();
}
}
public override bool HasFinished()
{
return finished && !Events.HasMoreElements();
}
public override bool HasMoreElements()
{
return !finished && !stopped && (started ? Events.HasMoreElements() : true);
}
public override WorkloadEvent Read()
{
if (!started)
{
var t = Task.Factory.StartNew(ReadEventsFromFile);
started = true;
}
WorkloadEvent result = null;
while (!Events.TryDequeue(out result))
{
if (stopped || finished)
{
return null;
}
Thread.Sleep(5);
}
return result;
}
protected override void Dispose(bool disposing)
{
if (!stopped)
{
stopped = true;
reader.Stop();
reader.Dispose();
}
}
}
}
================================================
FILE: ConvertWorkload/LocalDBManager.cs
================================================
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
using WorkloadTools;
namespace ConvertWorkload
{
internal class LocalDBManager
{
public bool IsElevated
{
get
{
return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
}
}
public string DownloadLocalDB()
{
var localPath = Path.GetTempPath() + "SqlLocalDB.msi";
using (var client = new WebClient())
{
var wp = WebRequest.DefaultWebProxy;
wp.Credentials = CredentialCache.DefaultCredentials;
client.Proxy = wp;
client.DownloadFile("https://download.microsoft.com/download/7/c/1/7c14e92e-bdcb-4f89-b7cf-93543e7112d1/SqlLocalDB.msi", localPath);
}
return localPath;
}
public void InstallLocalDB()
{
if (!IsElevated)
{
throw new InvalidOperationException("Installing LocalDB requires elevation.");
}
var localFileName = DownloadLocalDB();
var p = new Process();
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.FileName = "c:\\windows\\system32\\msiexec.exe";
p.StartInfo.Arguments = " /i "+ localFileName +" /qn IACCEPTSQLLOCALDBLICENSETERMS=YES";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
//Vista or higher check
if (System.Environment.OSVersion.Version.Major >= 6)
{
p.StartInfo.Verb = "runas";
}
p.Start();
p.WaitForExit();
}
public bool CanConnectToLocalDB()
{
try
{
var info = new SqlConnectionInfo();
info.ServerName = @"(localdb)\MSSQLLocalDB";
info.UseIntegratedSecurity = true;
using (var conn = new SqlConnection(info.ConnectionString() + ";Connect Timeout=30;"))
{
conn.Open();
}
return true;
}
catch(Exception)
{
return false;
}
}
}
}
================================================
FILE: ConvertWorkload/NLog.config
================================================
================================================
FILE: ConvertWorkload/Program.cs
================================================
using CommandLine;
using CommandLine.Text;
using NLog;
using NLog.Targets;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WorkloadTools.Listener.Trace;
namespace ConvertWorkload
{
class Program
{
private static Logger logger = LogManager.GetCurrentClassLogger();
private static CancellationTokenSource source;
static void Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(GenericErrorHandler);
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
var version = fvi.FileMajorPart.ToString() + "." + fvi.FileMinorPart.ToString() + "." + fvi.FileBuildPart.ToString();
var name = assembly.FullName;
logger.Info(name + " " + version);
try
{
var options = new Options();
if (!CommandLine.Parser.Default.ParseArguments(args, options))
{
return;
}
Run(options);
}
catch (Exception e)
{
logger.Error(e);
}
}
private static void Run(Options options)
{
// reconfigure loggers to use a file in the current directory
// or the file specified by the "Log" commandline parameter
if(LogManager.Configuration != null)
{
var target = (FileTarget)LogManager.Configuration.FindTargetByName("logfile");
if (target != null)
{
var pathToLog = options.LogFile;
if (pathToLog == null)
{
pathToLog = Path.Combine(Environment.CurrentDirectory, "ConvertWorkload.log");
}
if (!Path.IsPathRooted(pathToLog))
{
pathToLog = Path.Combine(Environment.CurrentDirectory, pathToLog);
}
target.FileName = pathToLog;
LogManager.ReconfigExistingLoggers();
}
}
// check whether localdb is installed
logger.Info("Checking LocalDB...");
var manager = new LocalDBManager();
if (!manager.CanConnectToLocalDB())
{
logger.Info("Installing LocalDB...");
try
{
manager.InstallLocalDB();
}
catch (InvalidOperationException)
{
logger.Error("This operation requires elevation. Restart the application as an administrator.");
return;
}
}
EventReader reader = null;
if (options.InputFile.EndsWith(".trc"))
{
reader = new SqlTraceEventReader(options.InputFile);
}
else
{
reader = new ExtendedEventsEventReader(options.InputFile);
}
EventWriter writer = new WorkloadFileEventWriter(options.OutputFile);
var converter = new WorkloadConverter(reader, writer);
if(options.ApplicationFilter != null)
{
converter.ApplicationFilter = new string[1] { options.ApplicationFilter };
}
if (options.DatabaseFilter != null)
{
converter.DatabaseFilter = new string[1] { options.DatabaseFilter };
}
if (options.HostFilter != null)
{
converter.HostFilter = new string[1] { options.HostFilter };
}
if (options.LoginFilter != null)
{
converter.LoginFilter = new string[1] { options.LoginFilter };
}
Console.CancelKeyPress += delegate (object sender, ConsoleCancelEventArgs e) {
e.Cancel = true;
logger.Info("Received shutdown signal...");
source.CancelAfter(TimeSpan.FromSeconds(10)); // give a 10 seconds cancellation grace period
converter.Stop();
};
var t = processConverter(converter);
t.Wait();
logger.Info("Converter stopped.");
}
public static void CancelNotification()
{
logger.Info("Shutdown complete.");
}
public static async Task processConverter(WorkloadConverter converter)
{
source = new CancellationTokenSource();
source.Token.Register(CancelNotification);
var completionSource = new TaskCompletionSource