Pour obtenir une clé
d'essai remplissez le formulaire ci-dessous
Demandez des tariffs
Nouvelle licence
Renouvellement de licence
--Sélectionnez la devise--
USD
EUR
RUB
* En cliquant sur ce bouton, vous acceptez notre politique de confidentialité

Free PVS-Studio license for Microsoft MVP specialists
To get the licence for your open-source project, please fill out this form
** En cliquant sur ce bouton, vous acceptez notre politique de confidentialité.

I am interested to try it on the platforms:
** En cliquant sur ce bouton, vous acceptez notre politique de confidentialité.

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

24 Jul 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 Incredibuild in your project: "Integrating PVS-Studio with the Incredibuild Distributed Build System".

Popular related articles
I want to use PVS-Studio in my project. The manager is against it. How to convince them?

Date: 02 Aoû 2022

Author: Sergey Vasiliev

You decided to integrate PVS-Studio into your project. But suddenly it turns out that the manager is against it, because... because why, actually? Let's try to figure out what to do with potential ob…
How PVS-Studio for Windows got new monitoring mode

Date: 14 Jui 2022

Author: Alexey Govorov

In PVS-Studio 7.18, the compiler monitoring utility for Windows got new mechanism that completely eliminates missed compiler launches. In this article, we will remind you how our analyzer copes with …
SAST in Secure SDLC: 3 reasons to integrate it in a DevSecOps pipeline

Date: 19 Avr 2022

Author: Sergey Vasiliev

Vulnerabilities produce enormous reputational and financial risks. That's why many companies are fascinated by security and desire to build a secure development life cycle (SSDLC). So, today we're go…
What's new in PVS-Studio in 2021?

Date: 31 Déc 2021

Author: Maxim Stefanov, Oleg Lisiy, Sergey Vasiliev

2021 is coming to an end, which means it's time to sum up the year! Today we'll tell you about the new features we added to PVS-Studio in the past year. Buckle up and let's go!
VSCode: how to view reports of static analyzers that support SARIF

Date: 09 Aoû 2021

Author: Nikolay Mironov

People increasingly start optimizing the process of finding code errors using static analyzers. Nowadays, we can choose from a variety of products to view analysis results. This post covers the ways …

Comments (0)

Next comments
Unicorn with delicious cookie
Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus
Accepter