To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

Free PVS-Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
Using IncrediBuild to Assist Analysis o…

Using IncrediBuild to Assist Analysis of a Large Project by PVS-Studio

Jul 24 2015

PVS-Studio is a static analyzer that detects errors in source code of C/C++ applications. Like a compiler, the analyzer parses the project source files one by one. However, without the help of auxiliary tools, some projects may take several hours to build and even longer to analyze. When building large projects, some developers use the distributed build technology implemented in the IncrediBuild tool. We will not discuss the details of integrating PVS-Studio into IncrediBuild in this article; instead, I will tell you about the specifics of analyzing a large project, time measurements, and other interesting things.

0339_IncrediBuild2/image1.png

About PVS-Studio and IncrediBuild

PVS-Studio analyzes C/C++ code and points out to the programmer code fragments that contain potential errors.

The analyzer is comprised of several components, while the analysis as such of each source file is done by the PVS-Studio.exe process (the analyzer kernel). Further in this article, I will use the term "thread" to mean that one thread contains one running PVS-Studio.exe process analyzing one source file. And we are going to have lots of files....

IncrediBuild is a distributed build application that allows you to easily distribute processes among a number of computers, thus speeding up your software's work. At the same time, you don't have to worry about dependencies typical of ordinary concurrent processes.

We are going to use IncrediBuild to analyze our test project in a number of threads by using additional computers.

About the test project

The authors of the project we are going to analyze didn't want us to reveal its name, but I can say that its size is about 7 million code lines. The code base size is 300 Mbytes in about 9000 files. It took us about 6 hours to analyze this project in 8 threads on a computer with Intel Core i7-4770 3.40 GHz CPU and 16 GB of RAM. Further in this article, I will tell you how we have managed to significantly boost the analysis speed by means of the IncrediBuild tool and a few additional computers.

Results

In all the tests, we were using computers with about the same configuration, allowing us to run the analysis in 8 threads on each.

When setting up the IncrediBuild tool on several computers, one of them is set as a coordinator, while the others are set as agents connecting to the coordinator. Since the project analysis was run on one of the agents, we set the IncrediBuild copy installed on this computer to run the analysis in one thread only to avoid overloading which could interfere with the measuring process. The coordinator was also set to use 1 thread only.

Test one

For the first test run of PVS-Studio, we used 5 computers:

  • Coordinator (1 thread);
  • Agent 1 (1 thread, analysis host);
  • Agent 2 (8 threads);
  • Agent 3 (8 threads);
  • Agent 4 (8 threads).

In total, it makes 1 + 1 + 8 + 8 + 8 = 26 threads to analyze 26 files at a time in parallel mode.

Figure 1 presents the scheme of project analysis parallelized into 26 threads.

0339_IncrediBuild2/image2.png

Figure 1 - Analyzing a project in 26 threads

Now a few words for those of you who are not familiar with IncrediBuild. Each green stripe corresponds to 1 process that has successfully finished on a computer whose name is written in the left column. The stripe carries the process name, while the time bar at the bottom of the window allows monitoring the process' start and finish points so that you can check the working time of every process.

The figure above represents analysis of relatively large source files. Process distribution is highly even and efficient when threads stay loaded for a long time.

Figure 2 presents analysis of source files of varied sizes.

0339_IncrediBuild2/image4.png

Figure 2 - Analyzing small and large project files in 26 threads

As you can see, quick thread termination causes certain overheads on creating new threads, so some of the computers may stay idle for a while. But generally the process distribution is pretty decent. It took us 2 hours 10 minutes to analyze this project, which makes a very nice difference compared to 6 hours.

Test two

For the second test run of PVS-Studio, we used 7 computers:

  • Coordinator (1 thread);
  • Agent 1 (2 threads, analysis host);
  • Agent 2 (8 threads);
  • Agent 3 (8 threads);
  • Agent 4 (8 threads);
  • Agent 5 (8 threads);
  • Agent 6 (8 threads).

In total, it makes 1 + 2 + 8 + 8 + 8 + 8 + 8 = 43 threads to analyze 43 files at a time in parallel mode.

Figure 3 presents the project analysis parallelized into 43 threads.

0339_IncrediBuild2/image6.png

Figure 3 - Analyzing a project in 43 threads.

You can't see the entire list of the 43 threads at once, but you can surely notice how greatly the delay time has grown for computers analyzing small files. Nevertheless, it still looks pretty nice, especially considering that it took us 1 hour 24 minutes instead of 6 hours to analyze the project, and the only effort we had made was to quickly install IncrediBuild on all the computers involved in the experiment. As for PVS-Studio, we only needed to change 1 settings option - i.e. define the thread number.

Conclusion

By using the IncrediBuild tool, usually used by developers to build especially heavy projects, we have managed to speed up the project analysis in PVS-Studio by 4.2 times, involving a few computers of the developers who were waiting nearby. All IncrediBuild's settings were set to default, and there are quite a number of them. I'm almost sure we could have obtained better performance, but we were interested in a "quick start".

So, once again, we needed to do the following to quickly launch the project analysis by PVS-Studio:

  • Install IncrediBuild on all the computers involved.
  • Set a larger number of threads in PVS-Studio's settings.
  • Run the analysis.

Achieved results:

  • Analysis on 1 computer - 6 hours.
  • Analysis in 26 threads - 2 hours 10 minutes.
  • Analysis in 43 threads - 1 hour 24 minutes.

In this article you can read about how to use PVS-Studio and InccrediBuild in your project: "Integrating PVS-Studio with the IncrediBuild Distributed Build System".

Popular related articles
Free PVS-Studio for those who develops open source projects

Date: Dec 22 2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
Appreciate Static Code Analysis!

Date: Oct 16 2017

Author: Andrey Karpov

I am really astonished by the capabilities of static code analysis even though I am one of the developers of PVS-Studio analyzer myself. The tool surprised me the other day as it turned out to be sma…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: Jul 31 2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…
The way static analyzers fight against false positives, and why they do it

Date: Mar 20 2017

Author: Andrey Karpov

In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment…
Static analysis as part of the development process in Unreal Engine

Date: Jun 27 2017

Author: Andrey Karpov

Unreal Engine continues to develop as new code is added and previously written code is changed. What is the inevitable consequence of ongoing development in a project? The emergence of new bugs in th…
Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities

Date: Nov 21 2018

Author: Andrey Karpov

A brief description of technologies used in the PVS-Studio tool, which let us effectively detect a large number of error patterns and potential vulnerabilities. The article describes the implementati…
The Last Line Effect

Date: May 31 2014

Author: Andrey Karpov

I have studied many errors caused by the use of the Copy-Paste method, and can assure you that programmers most often tend to make mistakes in the last fragment of a homogeneous code block. I have ne…
PVS-Studio ROI

Date: Jan 30 2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…
How PVS-Studio Proved to Be More Attentive Than Three and a Half Programmers

Date: Oct 22 2018

Author: Andrey Karpov

Just like other static analyzers, PVS-Studio often produces false positives. What you are about to read is a short story where I'll tell you how PVS-Studio proved, just one more time, to be more atte…
PVS-Studio for Java

Date: Jan 17 2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…

Comments (0)

Next comments
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →
Accept