Lines 77-82
Link Here
|
77 |
private static final Map<FileObject,int[]> MODIFIED = new WeakHashMap<FileObject, int[]>(); |
77 |
private static final Map<FileObject,int[]> MODIFIED = new WeakHashMap<FileObject, int[]>(); |
78 |
private final Ext<?> ext; |
78 |
private final Ext<?> ext; |
79 |
|
79 |
|
|
|
80 |
private static long regCount = 0; |
81 |
private static long regTime = 0; |
82 |
|
83 |
private static long unregCount = 0; |
84 |
private static long unregTime = 0; |
85 |
|
80 |
public Watcher() { |
86 |
public Watcher() { |
81 |
// Watcher disabled manually or for some tests |
87 |
// Watcher disabled manually or for some tests |
82 |
if (Boolean.getBoolean("org.netbeans.modules.masterfs.watcher.disable")) { |
88 |
if (Boolean.getBoolean("org.netbeans.modules.masterfs.watcher.disable")) { |
Lines 114-120
Link Here
|
114 |
if (fo.isData()) { |
120 |
if (fo.isData()) { |
115 |
fo = fo.getParent(); |
121 |
fo = fo.getParent(); |
116 |
} |
122 |
} |
|
|
123 |
// TODO remove new lines for time measurement |
124 |
long start = System.currentTimeMillis(); |
117 |
ext.register(fo); |
125 |
ext.register(fo); |
|
|
126 |
long end = System.currentTimeMillis(); |
127 |
|
128 |
regCount ++; |
129 |
regTime += (end - start); |
130 |
|
131 |
if (regCount % 100 == 0) { |
132 |
LOG.log(Level.INFO, "Registered {0} watchers in average time {1} ms", |
133 |
new Object[] {regCount, (double) regTime / regCount}); |
134 |
} |
118 |
} |
135 |
} |
119 |
|
136 |
|
120 |
public static void unregister(FileObject fo) { |
137 |
public static void unregister(FileObject fo) { |
Lines 128-134
Link Here
|
128 |
return; |
145 |
return; |
129 |
} |
146 |
} |
130 |
} |
147 |
} |
|
|
148 |
// TODO remove new lines for time measurement |
149 |
long start = System.currentTimeMillis(); |
131 |
ext.unregister(fo); |
150 |
ext.unregister(fo); |
|
|
151 |
long end = System.currentTimeMillis(); |
152 |
|
153 |
unregCount ++; |
154 |
unregTime += (end - start); |
155 |
|
156 |
if (unregCount % 100 == 0) { |
157 |
LOG.log(Level.INFO, "Unregistered {0} watchers in average time {1} ms", |
158 |
new Object[] {unregCount, (double) unregTime / unregCount}); |
159 |
} |
132 |
} |
160 |
} |
133 |
|
161 |
|
134 |
public static File wrap(File f, FileObject fo) { |
162 |
public static File wrap(File f, FileObject fo) { |