-
Notifications
You must be signed in to change notification settings - Fork 1
/
timing_executions.ps1
118 lines (91 loc) · 4.43 KB
/
timing_executions.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Create folders if not exist:
$null = [System.IO.Directory]::CreateDirectory('./raw_dataset/timing_analysis')
$ROSLYNATOR = "C:\Users\vlohse\.nuget\packages\roslynator.commandline\0.1.1\tools\net48\Roslynator.exe"
$MS_BUILD_PATH = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'
$NUGET_FULL_NAME = "AgodaAnalyzers.1.0.517"
$NUGET_PATH = "C:\Users\vlohse\Desktop\neural-repair-static-analysis\nuget_analyzer_packages\Agoda.Analyzers.1.0.517"
$CLONED_REPOS_DIR = "./cloned_repos_to_analyze"
$REPO_NAME = "runtime"
$REPO_URL = "https://github.com/dotnet/runtime.git"
$REPO_TO_ANALYZE = "$CLONED_REPOS_DIR/$REPO_NAME"
function ExecuteRoslynatorOnProjOrSol {
param (
$SOLUTION_FILENAME,
$SOLUTION_FILEPATH
)
$swStep = [Diagnostics.Stopwatch]::StartNew()
Write-Output "Working with SOLUTION_FILENAME: $SOLUTION_FILENAME"
$OUTPUT_FILENAME = "${REPO_NAME}__${SOLUTION_FILENAME}__${NUGET_FULL_NAME}"
$ANALYSIS_FILEPATH = "./raw_dataset/timing_analysis/${OUTPUT_FILENAME}.xml"
# Write-Output "
# roslynator analyze
# --msbuild-path $MS_BUILD_PATH
# $SOLUTION_FILEPATH
# -v quiet
# --output $ANALYSIS_FILEPATH
# --report-not-configurable
# --ignore-analyzer-references
# --analyzer-assemblies $NUGET_PATH `n"
C:\Users\vlohse\.nuget\packages\roslynator.commandline\0.1.1\tools\net48\Roslynator.exe analyze `
--msbuild-path $MS_BUILD_PATH `
$SOLUTION_FILEPATH `
--output $ANALYSIS_FILEPATH `
--report-not-configurable `
--ignore-analyzer-references `
--analyzer-assemblies $NUGET_PATH `
-v quiet
# report-not-configurable: Mostly compiler diagnostics (CSxxxx)
# ignore-analyzer-references: Only use our own analyzer assemblies
$swStep.Stop()
$ELAPSED_MINUTES = $swStep.Elapsed.TotalMinutes
$RESULT = "ELAPSED_MINUTES: $ELAPSED_MINUTES"
$TIMER_RESULTS_PATH = "./raw_dataset/timing_analysis/${OUTPUT_FILENAME}__TIMING.txt"
$RESULT > $TIMER_RESULTS_PATH
}
Write-Output "Cloning: $REPO_NAME"
git clone $REPO_URL $REPO_TO_ANALYZE
### ---------------------------------------------
# $SOLUTION_FILES = Get-Childitem -File -force -Recurse -Include *.sln -Path "/Users/vincent/not_in_cloud/Codes/KTH/acr-static-analysis-code/cloned_repos_to_analyze/runtime/src/libraries/Microsoft.Extensions.Caching.Memory" |
$SOLUTION_FILES = Get-Childitem -File -force -Recurse -Include *.sln -Path $REPO_TO_ANALYZE |
Foreach-Object {
$FILENAME = $_.Name
$DIRECTORY = $_.Directory
@{ Filename = $FILENAME; Filepath = "$DIRECTORY/$FILENAME" }
}
$NUMBER_SOLUTIONS = $SOLUTION_FILES.Count
Write-Output "NUMBER_SOLUTIONS: $NUMBER_SOLUTIONS"
$swTotal = [Diagnostics.Stopwatch]::StartNew()
foreach ($SOLUTION_FILE in $SOLUTION_FILES) {
$SOLUTION_FILENAME = $SOLUTION_FILE.Filename
$SOLUTION_FILEPATH = $SOLUTION_FILE.Filepath
ExecuteRoslynatorOnProjOrSol -SOLUTION_FILENAME $SOLUTION_FILENAME -SOLUTION_FILEPATH $SOLUTION_FILEPATH
}
$swTotal.Stop()
$ELAPSED_MINUTES = $swTotal.Elapsed.TotalMinutes
Write-Output "ELAPSED_MINUTES: $ELAPSED_MINUTES"
$RESULT = "NUMBER_SOLUTIONS: $NUMBER_SOLUTIONS; ELAPSED_MINUTES: $ELAPSED_MINUTES"
$TIMER_RESULTS_PATH = "./raw_dataset/timing_analysis/TIMED__PER_SOLUTION__${REPO_NAME}__${NUGET_FULL_NAME}.txt"
[void](New-Item -ItemType "file" -Path $TIMER_RESULTS_PATH)
$RESULT > $TIMER_RESULTS_PATH
### ---------------------------------------------
$swTotal = [Diagnostics.Stopwatch]::StartNew()
$PROJECT_FILES = Get-Childitem -File -force -Recurse -Include *.csproj -Path $REPO_TO_ANALYZE |
Foreach-Object {
$FILENAME = $_.Name
$DIRECTORY = $_.Directory
@{ Filename = $FILENAME; Filepath = "$DIRECTORY/$FILENAME" }
}
$NUMBER_PROJECTS = $PROJECT_FILES.Count
Write-Output "NUMBER_PROJECTS: $NUMBER_PROJECTS"
foreach ($PROJECT_FILE in $PROJECT_FILES) {
$PROJECT_FILENAME = $PROJECT_FILE.Filename
$PROJECT_FILEPATH = $PROJECT_FILE.Filepath
ExecuteRoslynatorOnProjOrSol -SOLUTION_FILENAME $PROJECT_FILENAME -SOLUTION_FILEPATH $PROJECT_FILEPATH
}
$swTotal.Stop()
$ELAPSED_MINUTES = $swTotal.Elapsed.TotalMinutes
Write-Output "ELAPSED_MINUTES: $ELAPSED_MINUTES"
$RESULT = "NUMBER_PROJECTS: $NUMBER_PROJECTS; ELAPSED_MINUTES: $ELAPSED_MINUTES;"
$TIMER_RESULTS_PATH = "./raw_dataset/timing_analysis/TIMED__PER_PROJECT__${REPO_NAME}__${NUGET_FULL_NAME}.txt"
[void](New-Item -ItemType "file" -Path $TIMER_RESULTS_PATH)
$RESULT > $TIMER_RESULTS_PATH