dextool.plugin.analyze.analyze

Members

Classes

Pool
class Pool
Undocumented in source.

Functions

analyzeWorker
void analyzeWorker(Tid owner, AnalyzeBuilder analyze_builder, size_t file_idx, size_t total_files, ParsedCompileCommand pdata, AbsolutePath restrictDir)
Undocumented in source. Be warned that the author may not have intended to support it.
doAnalyze
ExitStatusType doAnalyze(AnalyzeBuilder analyze_builder, AnalyzeResults analyze_results, string[] in_cflags, string[] in_files, CompileCommandDB compile_db, AbsolutePath restrictDir, int workerThreads)
Undocumented in source. Be warned that the author may not have intended to support it.
immReuse
immutable(ParsedCompileCommand) immReuse(ParsedCompileCommand v)

The commands have a lifetime that persist throughout the whole analyze thus just reuse them as-is.

Structs

AnalyzeBuilder
struct AnalyzeBuilder

Hold the configuration parameters used to construct analyze collections.

AnalyzeCollection
struct AnalyzeCollection

Analyzers used in worker threads to collect results.

AnalyzeResults
struct AnalyzeResults

Results collected in the main thread.

Meta

License

MPL-2

Authors

Joakim Brännström (joakim.brannstrom@gmx.com)

This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Threading information flow Main thread: Get all the files to analyze. Spawn worker threads. Send to the worker thread the: - file to analyze - enough data to construct an analyzer collection Collect the received analyze data from worker threads. Wait until all files are analyzed and the last worker thread has sent back the data. Dump the result according to the users config via CLI.

Worker thread: Connect a clang AST visitor with an analyzer constructed from the builder the main thread sent over. Run the analyze pass. Send back the analyze result to the main thread.

# Design Assumptions - No actual speed is gained if the working threads are higher than the core count. Thus the number of workers are <= CPU count. - The main thread that receive the data completely empty its mailbox. This is not interleaved with spawning new workers. This behavior will make it so that the worker threads sending data to the main thread reach an equilibrium. The number of worker threads are limited by the amount of data that the main thread can receive.