At different phases of the software development, developers may have different time and resource constraints. When editing code in an IDE, users may like to run Coderrect repeatedly and see the results as fast as possible. When testing code before a release, users may want to run Coderrect overnight on machines with large memory and core counts to exhaustively check all possible errors.
To fit in different use scenarios, Coderrect offers pay-as-you-go detection: the more time you afford to run Coderrect, the better results, i.e., more code coverage and more precise results, you will likely get.
Coderrect has three modes: default, fast, and exhaust. These modes can be configured by the
$ coderrect -mode=[default|fast|exhaust]
Default mode aims to fit most uses. It exploits a balance between performance, code coverage and precision. The default mode is pretty fast and scalable: it can analyze over a million lines of C/C++ code such as the Linux kernel in less than ten minutes.
Fast mode is optimized for speed. For large code base it can be many times faster than the default mode, even though it may possibly lose some analysis precision. At code development time, users may prefer to run Coderrect with “
-mode=fast” to turn on the fast mode to reduce the waiting time.
$ coderrect -mode=fast make
Exhaust mode is optimized for coverage and will exhaustively check all possible races under all code paths, all files and modules, as well as all call chains and dependencies.
At nightly build time, you may prefer to run Coderrect with “
-mode=exhaust” to find all possible race conditions as precise as possible when there is enough time to run (e.g., eight hours):
$ coderrect -mode=exhaust make
Sample Performance Results on Redis
The following shows the performance of the fast mode on analyzing the Redis server:
The fast mode finishes in less than two minutes and detects 12 races:
The following shows the performance of the exhaust mode on analyzing the Redis server:
The exhaust mode finishes in around 75 mins and detects 22 races: