[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

  • From: Alexander Simon < >
  • To:
  • Subject: [hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...
  • Date: Fri, 15 Feb 2013 00:14:20 -0800

changeset 26a2099bcc9a in cnd-main ((none))
details: http://hg.netbeans.org/cnd-main/rev/26a2099bcc9a
description:
        fixing Bug #225299 Detect C/C++ specific performance problem
        - fix messages

diffstat:

 
cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/AnalyzeStat.java
              |   7 ++-
 
cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
 |  21 ++++++---
 2 files changed, 20 insertions(+), 8 deletions(-)

diffs (97 lines):

diff --git 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/AnalyzeStat.java
 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/AnalyzeStat.java
--- 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/AnalyzeStat.java
+++ 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/AnalyzeStat.java
@@ -62,9 +62,9 @@
     
     void process() {
         upEmptyFolder();
-        dumpAll();
         getBigUnused();
         groupByReadingSpeed();
+        dumpAll();
         getSlowReading();
     }
 
@@ -129,11 +129,16 @@
                 return (int)(k2 - k1);
             }
         });
+        i = 0;
         for (Map.Entry<String, AgregatedStat> entry : slow) {
              PerformanceIssueDetector.LOG.log(Level.INFO, "Slow reading 
files in the folder {0}. Reading {1} lines consumes {2}s.", // NOI18N
                      new Object[]{entry.getKey(),
                                   
PerformanceIssueDetector.format(entry.getValue().readLines),
                                   
PerformanceIssueDetector.format(entry.getValue().readTime/PerformanceIssueDetector.NANO_TO_SEC)});
+             i++;
+             if (i > 5) {
+                 break;
+             }
         }
     }
     
diff --git 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
--- 
a/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
+++ 
b/cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
@@ -530,7 +530,6 @@
     })
     private void analyzeCreateItems() {
         int CREATION_SPEED_LIMIT = 100;
-        int CREATION_SPEED_EXPECTED = 1000;
         long itemCount = 0;
         long time = 0;
         long cpu = 0;
@@ -549,7 +548,7 @@
         if (wallTime > 15 && itemCount > 100 && creationSpeed < 
CREATION_SPEED_LIMIT) {
             if (!slowItemCreation) {
                 slowItemCreation = true;
-                final String details = 
Bundle.Details_slow_item_creation(format(wallTime), format(itemCount), 
format(creationSpeed), format(CREATION_SPEED_EXPECTED));
+                final String details = 
Bundle.Details_slow_item_creation(format(wallTime), format(itemCount), 
format(creationSpeed), format(CREATION_SPEED_LIMIT));
                 if (!CndUtils.isUnitTestMode() && !CndUtils.isStandalone() 
&& canNotify()) {
                     notifyProblem(NotifyProjectProblem.CREATE_PROBLEM, 
details);
                 }
@@ -572,7 +571,6 @@
     })
     private void analyzeReadFile() {
         int READING_SPEED_LIMIT = 100;
-        int READING_SPEED_EXPECTED = 1000;
         long fileCount = 0;
         long read = 0;
         long lines = 0;
@@ -595,7 +593,7 @@
         if (wallTime > 100 && fileCount > 100 && readSpeed < 
READING_SPEED_LIMIT) {
             if (!slowFileRead) {
                 slowFileRead = true;
-                final String details = 
Bundle.Details_slow_file_read(format(wallTime), format(read/1000), 
format(readSpeed), format(READING_SPEED_EXPECTED));
+                final String details = 
Bundle.Details_slow_file_read(format(wallTime), format(read/1000), 
format(readSpeed), format(READING_SPEED_LIMIT));
                 if (!CndUtils.isUnitTestMode() && !CndUtils.isStandalone() 
&& canNotify()) {
                     notifyProblem(NotifyProjectProblem.READ_PROBLEM, 
details);
                 }
@@ -617,7 +615,7 @@
                                 +"The average parsing speed is {2} lines per 
second.<br>\n"
                                 +"In other hand IDE consumed {3} seconds of 
CPU time to parse these files.<br>\n"
                                 +"The ratio of wall time to CPU time is 
1/{4}.<br>\n"
-                                +"It shows that IDE spent too mach time 
waiting for resources.<br>\n"
+                                +"It shows that IDE spent too much time 
waiting for resources.<br>\n"
                                 +"IDE expects the ratio is more than 
1/{5}.<br>\n"
                                 +"Most probably this is caused by poor 
overall file system performance.\n"
     })
@@ -684,8 +682,17 @@
             long delta = (System.nanoTime() - 
event.getStartTime())/NANO_TO_SEC;
             if (delta > 100) {
                 iterator.remove();
-                buf.append(Bundle.Details_infinite_file_parse(fo.getPath(), 
format(delta)));
-                LOG.log(Level.INFO, "Too long file {0} parsing time {1}s. 
Probably parser has infinite loop or file is too big", new 
Object[]{fo.getPath(), format(delta)}); //NOI18N
+                long time = event.getTime();
+                long cpu = event.getCpuTime();
+                if (event.getAttrs().length == 0) {
+                    //TODO: process timeout
+                    if (time > cpu && cpu > 0) {
+                        if (time/cpu < 5) {
+                            
buf.append(Bundle.Details_infinite_file_parse(fo.getPath(), format(delta)));
+                            LOG.log(Level.INFO, "Too long file {0} parsing 
time {1}s. Probably parser has infinite loop or file is too big", new 
Object[]{fo.getPath(), format(delta)}); //NOI18N
+                        }
+                    }
+                }
             }
         }
         if (buf.length() > 0) {

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/01/2013

<Possible follow-up(s)>

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/01/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/04/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/06/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/07/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/07/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/08/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/08/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/12/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/15/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/19/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/21/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/21/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/22/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/22/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/22/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/25/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/25/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/26/2013

[hg] cnd-main: fixing Bug #225299 Detect C/C++ specific performa...

Alexander Simon 02/26/2013

Project Features

About this Project

CND was started in November 2009, is owned by DimaZh, and has 186 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close