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

  • From: Alexander Simon < >
  • To:
  • Subject: [hg] main-silver: fixing Bug #225299 Detect C/C++ specific perfo...
  • Date: Wed, 06 Feb 2013 00:35:24 -0800

changeset ee45be54119d in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/ee45be54119d
description:
        fixing Bug #225299 Detect C/C++ specific performance problem
        - log file IO in CndFileUtils (used to resolve include paths)

diffstat:

 cnd.discovery/nbproject/project.xml                                          
                  |   2 +-
 
cnd.discovery/src/org/netbeans/modules/cnd/discovery/performance/PerformanceIssueDetector.java
 |  31 ++++++++++
 cnd.utils/nbproject/project.properties                                       
                  |   2 +-
 cnd.utils/nbproject/project.xml                                              
                  |   2 +-
 cnd.utils/src/org/netbeans/modules/cnd/utils/cache/CndFileUtils.java         
                  |  12 +++-
 5 files changed, 45 insertions(+), 4 deletions(-)

diffs (140 lines):

diff --git a/cnd.discovery/nbproject/project.xml 
b/cnd.discovery/nbproject/project.xml
--- a/cnd.discovery/nbproject/project.xml
+++ b/cnd.discovery/nbproject/project.xml
@@ -107,7 +107,7 @@
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
-                        <specification-version>1.0</specification-version>
+                        <specification-version>1.32</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
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
@@ -41,6 +41,7 @@
  */
 package org.netbeans.modules.cnd.discovery.performance;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -61,6 +62,7 @@
 import org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl;
 import org.netbeans.modules.cnd.utils.CndPathUtilitities;
 import org.netbeans.modules.cnd.utils.CndUtils;
+import org.netbeans.modules.cnd.utils.cache.CndFileUtils;
 import org.netbeans.modules.dlight.libs.common.PerformanceLogger;
 import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
 import org.openide.filesystems.FileObject;
@@ -118,6 +120,8 @@
     public void processEvent(PerformanceLogger.PerformanceEvent event) {
         if (Folder.LS_FOLDER_PERFORMANCE_EVENT.equals(event.getId())) {
             processCreateFolder(event);
+        } else if 
(CndFileUtils.LS_FOLDER_UTILS_PERFORMANCE_EVENT.equals(event.getId())) {
+            processCreateFolderIO(event);
         } else if 
(Folder.CREATE_ITEM_PERFORMANCE_EVENT.equals(event.getId())) {
             processCreateItem(event);
         } else if 
(Folder.GET_ITEM_FILE_OBJECT_PERFORMANCE_EVENT.equals(event.getId())) {
@@ -156,6 +160,33 @@
         }
     }
 
+    private void processCreateFolderIO(PerformanceLogger.PerformanceEvent 
event) {
+        File fo = (File) event.getSource();
+        String dirName = fo.getPath();
+        long time = event.getTime();
+        if (event.getAttrs().length == 0) {
+            //TODO: process timeout
+            LOG.log(timeOutLevel, "Timeout {0}s of directory list {1}", new 
Object[]{time/NANO_TO_SEC, dirName}); //NOI18N
+            return;
+        }
+        long cpu = event.getCpuTime();
+        long user = event.getUserTime();
+        lock.writeLock().lock();
+        try {
+            CreateEntry entry = createPerformance.get(dirName);
+            if (entry == null) {
+                entry = new CreateEntry();
+                createPerformance.put(dirName, entry);
+            }
+            entry.number++;
+            entry.time += time;
+            entry.cpu += cpu;
+            entry.user += user;
+        } finally {
+            lock.writeLock().unlock();
+        }
+    }
+
     private void processCreateItem(PerformanceLogger.PerformanceEvent event) 
{
         String path;
         if (event.getSource() instanceof FileObject) {
diff --git a/cnd.utils/nbproject/project.properties 
b/cnd.utils/nbproject/project.properties
--- a/cnd.utils/nbproject/project.properties
+++ b/cnd.utils/nbproject/project.properties
@@ -1,6 +1,6 @@
 javac.compilerargs=-Xlint -Xlint:-serial
 javac.source=1.6
-spec.version.base=1.31.0
+spec.version.base=1.32
 
 test.config.stableBTD.includes=**/*Test.class
 test.config.stableBTD.excludes=\
diff --git a/cnd.utils/nbproject/project.xml b/cnd.utils/nbproject/project.xml
--- a/cnd.utils/nbproject/project.xml
+++ b/cnd.utils/nbproject/project.xml
@@ -10,7 +10,7 @@
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
-                        <specification-version>1.19</specification-version>
+                        <specification-version>1.23</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git 
a/cnd.utils/src/org/netbeans/modules/cnd/utils/cache/CndFileUtils.java 
b/cnd.utils/src/org/netbeans/modules/cnd/utils/cache/CndFileUtils.java
--- a/cnd.utils/src/org/netbeans/modules/cnd/utils/cache/CndFileUtils.java
+++ b/cnd.utils/src/org/netbeans/modules/cnd/utils/cache/CndFileUtils.java
@@ -64,6 +64,7 @@
 import org.netbeans.modules.cnd.utils.FSPath;
 import org.netbeans.modules.dlight.libs.common.InvalidFileObjectSupport;
 import org.netbeans.modules.dlight.libs.common.PathUtilities;
+import org.netbeans.modules.dlight.libs.common.PerformanceLogger;
 import org.openide.filesystems.FileAttributeEvent;
 import org.openide.filesystems.FileChangeListener;
 import org.openide.filesystems.FileEvent;
@@ -85,6 +86,8 @@
     private static final boolean TRUE_CASE_SENSITIVE_SYSTEM;
     private static final FileChangeListener FSL = new FSListener();
     private static final FileSystem fileFileSystem;
+    public static final int FS_TIME_OUT = 15;
+    public static final String LS_FOLDER_UTILS_PERFORMANCE_EVENT = 
"LS_FOLDER_UTILS_PERFORMANCE_EVENT"; //NOI18N
     static {
         FileSystem afileFileSystem = null;
         File tmpDirFile = new File(System.getProperty("java.io.tmpdir")); 
//NOI18N
@@ -541,7 +544,11 @@
     private static CndFileSystemProvider.FileInfo[] listFilesImpl(File file) 
{
         CndFileSystemProvider.FileInfo[] info = 
CndFileSystemProvider.getChildInfo(file.getAbsolutePath());
         if (info == null) {
-            File[] children = file.listFiles();
+            PerformanceLogger.PerformaceAction lsPerformanceEvent = 
PerformanceLogger.getLogger().start(CndFileUtils.LS_FOLDER_UTILS_PERFORMANCE_EVENT,
 file);
+            File[] children = null;
+            try { 
+                lsPerformanceEvent.setTimeOut(CndFileUtils.FS_TIME_OUT);
+                children = file.listFiles();
             if (children != null) {
                 info = new CndFileSystemProvider.FileInfo[children.length];
                 for (int i = 0; i < children.length; i++) {
@@ -550,6 +557,9 @@
             } else {
                 info = new CndFileSystemProvider.FileInfo[0];
             }
+            } finally {
+                lsPerformanceEvent.log(children == null ? 0 : 
children.length);
+            }
         }
         return info;
     }

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

Alexander Simon 02/01/2013

<Possible follow-up(s)>

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

Alexander Simon 02/01/2013

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

Alexander Simon 02/01/2013

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

Alexander Simon 02/04/2013

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

Alexander Simon 02/06/2013

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

Alexander Simon 02/07/2013

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

Alexander Simon 02/07/2013

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

Alexander Simon 02/08/2013

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

Alexander Simon 02/08/2013

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

Alexander Simon 02/08/2013

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

Alexander Simon 02/12/2013

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

Alexander Simon 02/19/2013

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

Alexander Simon 02/19/2013

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

Alexander Simon 02/22/2013

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

Alexander Simon 02/22/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