-
Notifications
You must be signed in to change notification settings - Fork 91
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
Memory tuning #2619
Closed
Closed
Memory tuning #2619
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
90a2e56
Resolve task invocation issue that prevented effective parallelism.
michaelcfanning 5edfd3a
Remove context object from disk enum call.
michaelcfanning ec93dcc
Update release notes.
michaelcfanning e01b471
Merge remote-tracking branch 'origin' into memory-tuning
michaelcfanning 8144521
Work in flight for ongoing memory tuning.
michaelcfanning e2828ab
Add comment documenting disabling of file caching of results, by file…
michaelcfanning 5595b31
Memory tuning.
michaelcfanning 51b82e5
Remove compute hashes field, as unused.
michaelcfanning fe6686d
Remove compute hashes field, as unused.
michaelcfanning 79da60e
Formatting.
michaelcfanning 25ced28
Merge branch 'main' into memory-tuning
michaelcfanning 0fe3695
Update release notes.
michaelcfanning ee15385
Update to try write in channel use.
michaelcfanning e2199de
Add max-targets (default 25k) for limiting memory use.
michaelcfanning File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net472" /> | ||
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net472" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,13 @@ | |
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
|
||
using CommandLine; | ||
|
||
using Microsoft.CodeAnalysis.Sarif.Writers; | ||
|
||
namespace Microsoft.CodeAnalysis.Sarif.Driver | ||
{ | ||
[Verb("analyze", HelpText = "Analyze one or more binary files for security and correctness issues.")] | ||
|
@@ -15,9 +19,9 @@ public AnalyzeOptionsBase() | |
{ | ||
// TODO: these defaults need to be converted to the configuration | ||
// property pattern as followed by MaxFileSizeInKilobytes. | ||
Traces = new string[] { }; | ||
Kind = new List<ResultKind> { ResultKind.Fail }; | ||
Level = new List<FailureLevel> { FailureLevel.Warning, FailureLevel.Error }; | ||
Trace = new string[] { }; | ||
Check warning Code scanning / CodeQL Virtual call in constructor or destructor
Avoid virtual calls in a constructor or destructor.
|
||
Kind = BaseLogger.Fail; | ||
Level = BaseLogger.ErrorWarning; | ||
|
||
MaxFileSizeInKilobytes = AnalyzeContextBase.MaxFileSizeInKilobytesDefaultValue; | ||
} | ||
|
@@ -100,7 +104,21 @@ public AnalyzeOptionsBase() | |
HelpText = "Execution traces, expressed as a semicolon-delimited list, that " + | ||
"should be emitted to the console and log file (if appropriate). " + | ||
"Valid values: ScanTime.")] | ||
public virtual IEnumerable<string> Traces { get; set; } | ||
public virtual IEnumerable<string> Trace { get; set; } | ||
|
||
private DefaultTraces? defaultTraces; | ||
public DefaultTraces Traces | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{ | ||
get | ||
{ | ||
defaultTraces ??= | ||
this.Trace.Any() | ||
? (DefaultTraces)Enum.Parse(typeof(DefaultTraces), string.Join(",", this.Trace)) | ||
: DefaultTraces.None; | ||
|
||
return this.defaultTraces.Value; | ||
} | ||
} | ||
|
||
[Option( | ||
"level", | ||
|
@@ -109,13 +127,33 @@ public AnalyzeOptionsBase() | |
HelpText = "A semicolon delimited list to filter output of scan results to one or more failure levels. Valid values: Error, Warning and Note.")] | ||
public IEnumerable<FailureLevel> Level { get; set; } | ||
|
||
private IImmutableSet<FailureLevel> failureLevels; | ||
public IImmutableSet<FailureLevel> FailureLevels | ||
{ | ||
get | ||
{ | ||
this.failureLevels ??= new List<FailureLevel>(Level).ToImmutableHashSet(); | ||
return this.failureLevels; | ||
} | ||
} | ||
|
||
[Option( | ||
"kind", | ||
Separator = ';', | ||
Default = new ResultKind[] { ResultKind.Fail }, | ||
HelpText = "A semicolon delimited list to filter output to one or more result kinds. Valid values: Fail (for literal scan results), Pass, Review, Open, NotApplicable and Informational.")] | ||
public IEnumerable<ResultKind> Kind { get; set; } | ||
|
||
private IImmutableSet<ResultKind> resultKinds; | ||
public IImmutableSet<ResultKind> ResultKinds | ||
{ | ||
get | ||
{ | ||
this.resultKinds ??= new List<ResultKind>(Kind).ToImmutableHashSet(); | ||
return this.resultKinds; | ||
} | ||
} | ||
|
||
[Option( | ||
"baseline", | ||
HelpText = "A SARIF file to be used as baseline.")] | ||
|
@@ -131,5 +169,12 @@ public AnalyzeOptionsBase() | |
HelpText = "The maximum file size (in kilobytes) that will be analyzed.", | ||
Default = -1)] | ||
public long MaxFileSizeInKilobytes { get; set; } | ||
|
||
[Option( | ||
"max-targets", | ||
HelpText = "The maximum number of targets that will be prepared for analysis. Use this to limit memory usage.", | ||
Default = 25000)] | ||
public int MaxTargets { get; set; } | ||
|
||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I've clobbered caching by file hash in general with this change. It will not come back for the single-threaded analysis, as this engine is getting dropped entirely.