-
Notifications
You must be signed in to change notification settings - Fork 93
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
Implement multithreaded driver analyze command w/deterministic output #2146
Conversation
This pull request introduces 3 alerts when merging f40a308 into 173eaa0 - view on LGTM.com new alerts:
|
src/Sarif/Sarif.csproj
Outdated
<Reference Condition="'$(TargetFramework)' == 'net45' Or '$(TargetFramework)' == 'net461' " Include="System.Web" /> | ||
<Reference Condition="'$(TargetFramework)' == 'net45' " Include="System.Runtime" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this, since we don't target net45 #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And, for line 38, we should update and add net452 and probably net472. #Resolved
This pull request introduces 3 alerts when merging 6ef9b22 into 3f4d953 - view on LGTM.com new alerts:
|
src/Sarif/Sarif.csproj
Outdated
<Reference Condition="'$(TargetFramework)' == 'net45' Or '$(TargetFramework)' == 'net461' " Include="System.Web" /> | ||
<Reference Condition="'$(TargetFramework)' == 'net45' " Include="System.Runtime" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And, for line 38, we should update and add net452 and probably net472. #Resolved
src/Sarif/HashUtilities.cs
Outdated
fileToHashDataMap[filePath] = HashUtilities.ComputeHashes(filePath); | ||
HashData hashData = HashUtilities.ComputeHashes(filePath); | ||
|
||
lock (fileToHashDataMap) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using a ConcurrentDictionary, probably we won't need the lock. #Resolved
|
||
namespace Microsoft.CodeAnalysis.Sarif.Multitool | ||
{ | ||
public class AnalyzeTestSkimmer : Skimmer<AnalyzeTestContext> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this in a test, should we mark as internal or add a #if debug condition? #Resolved
namespace Microsoft.CodeAnalysis.Sarif.Multitool | ||
{ | ||
[Verb("analyze-test", HelpText = "Test the analysis driver framework.")] | ||
public class AnalyzeTestOptions : MultithreadedAnalyzeOptionsBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this in a test, should we mark as internal or add a #if debug condition? #Resolved
{ | ||
public Exception TargetLoadException { get; set; } | ||
|
||
public bool IsValidAnalysisTarget { get; set; } | ||
public bool IsValidAnalysisTarget |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be replaced for this: public bool IsValidAnalysisTarget => true;
#Resolved
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Collections.Generic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we remove those using's that we are not using? #Resolved
|
||
namespace Microsoft.CodeAnalysis.Sarif.Multitool | ||
{ | ||
public class AnalyzeTestCommand : MultithreadedAnalyzeCommandBase<AnalyzeTestContext, AnalyzeTestOptions> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we mark as internal or add a #if debug since its a test? #Resolved
This pull request introduces 3 alerts when merging 2de08a1 into 6443453 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging be28b85 into 6443453 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging c7f4fb7 into 6443453 - view on LGTM.com new alerts:
|
This change introduces a new MultithreadedAnalyzeCommand that parallelizes analysis while also guaranteeing that all results are output in a deterministic order run-over-run. The mechanism is like so:
To test the above, I've added an 'analyze-test' command to the multitool, which can be a temporary addition until we harden the new code and dropped the single-threaded analysis entirely (this analysis command can eventually be replaced by the multithread analysis configured to run on a single thread). Because we've hit our limit for verbs (as supported by CommandLineLibrary), I had to drop a result matching verb previously used mostly for testing.
Other work and open items:
@eddynaka, this is still a draft.