Skip to content

Commit b4d1c83

Browse files
committed
More options to control goroutines
1 parent cf36893 commit b4d1c83

File tree

3 files changed

+64
-55
lines changed

3 files changed

+64
-55
lines changed

SCC-OUTPUT-REPORT.html

Lines changed: 35 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
</tr></thead>
1313
<tbody><tr>
1414
<th>Go</th>
15-
<th>30</th>
16-
<th>9637</th>
17-
<th>1482</th>
18-
<th>469</th>
19-
<th>7686</th>
20-
<th>1536</th>
21-
<th>256898</th>
22-
<th>4098</th>
15+
<th>28</th>
16+
<th>9570</th>
17+
<th>1462</th>
18+
<th>452</th>
19+
<th>7656</th>
20+
<th>1528</th>
21+
<th>255227</th>
22+
<th>4068</th>
2323
</tr><tr>
2424
<td>processor/formatters.go</td>
2525
<td></td>
@@ -63,23 +63,23 @@
6363
</tr><tr>
6464
<td>processor/processor.go</td>
6565
<td></td>
66-
<td>671</td>
66+
<td>672</td>
6767
<td>141</td>
6868
<td>104</td>
69-
<td>426</td>
69+
<td>427</td>
7070
<td>92</td>
71-
<td>19411</td>
72-
<td>438</td>
71+
<td>19457</td>
72+
<td>439</td>
7373
</tr><tr>
7474
<td>main.go</td>
7575
<td></td>
76-
<td>404</td>
76+
<td>429</td>
7777
<td>10</td>
7878
<td>6</td>
79-
<td>388</td>
79+
<td>413</td>
8080
<td>10</td>
81-
<td>8969</td>
82-
<td>256</td>
81+
<td>9693</td>
82+
<td>271</td>
8383
</tr><tr>
8484
<td>processor/detector_test.go</td>
8585
<td></td>
@@ -220,16 +220,6 @@
220220
<td>19</td>
221221
<td>2043</td>
222222
<td>60</td>
223-
</tr><tr>
224-
<td>processor/processor_unix.go</td>
225-
<td></td>
226-
<td>69</td>
227-
<td>14</td>
228-
<td>14</td>
229-
<td>41</td>
230-
<td>8</td>
231-
<td>2030</td>
232-
<td>52</td>
233223
</tr><tr>
234224
<td>processor/filereader.go</td>
235225
<td></td>
@@ -250,16 +240,6 @@
250240
<td>0</td>
251241
<td>2209</td>
252242
<td>35</td>
253-
</tr><tr>
254-
<td>processor/bloom.go</td>
255-
<td></td>
256-
<td>37</td>
257-
<td>7</td>
258-
<td>12</td>
259-
<td>18</td>
260-
<td>2</td>
261-
<td>1062</td>
262-
<td>29</td>
263243
</tr><tr>
264244
<td>processor/cocomo_test.go</td>
265245
<td></td>
@@ -270,6 +250,16 @@
270250
<td>6</td>
271251
<td>686</td>
272252
<td>23</td>
253+
</tr><tr>
254+
<td>processor/bloom.go</td>
255+
<td></td>
256+
<td>37</td>
257+
<td>7</td>
258+
<td>12</td>
259+
<td>18</td>
260+
<td>2</td>
261+
<td>1062</td>
262+
<td>29</td>
273263
</tr><tr>
274264
<td>processor/helpers_test.go</td>
275265
<td></td>
@@ -280,16 +270,6 @@
280270
<td>4</td>
281271
<td>434</td>
282272
<td>18</td>
283-
</tr><tr>
284-
<td>processor/processor_unix_test.go</td>
285-
<td></td>
286-
<td>24</td>
287-
<td>6</td>
288-
<td>3</td>
289-
<td>15</td>
290-
<td>0</td>
291-
<td>411</td>
292-
<td>16</td>
293273
</tr><tr>
294274
<td>examples/language/go.go</td>
295275
<td></td>
@@ -323,16 +303,16 @@
323303
</tr></tbody>
324304
<tfoot><tr>
325305
<th>Total</th>
326-
<th>30</th>
327-
<th>9637</th>
328-
<th>1482</th>
329-
<th>469</th>
330-
<th>7686</th>
331-
<th>1536</th>
332-
<th>256898</th>
333-
<th>4098</th>
306+
<th>28</th>
307+
<th>9570</th>
308+
<th>1462</th>
309+
<th>452</th>
310+
<th>7656</th>
311+
<th>1528</th>
312+
<th>255227</th>
313+
<th>4068</th>
334314
</tr>
335315
<tr>
336-
<th colspan="9">Estimated Cost to Develop (organic) $229,922<br>Estimated Schedule Effort (organic) 7.87 months<br>Estimated People Required (organic) 2.60<br></th>
316+
<th colspan="9">Estimated Cost to Develop (organic) $228,979<br>Estimated Schedule Effort (organic) 7.85 months<br>Estimated People Required (organic) 2.59<br></th>
337317
</tr></tfoot>
338318
</table></body></html>

main.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package main
55
import (
66
"fmt"
77
"os"
8+
"runtime"
89
"strings"
910

1011
"github.com/boyter/scc/v3/processor"
@@ -140,6 +141,30 @@ func main() {
140141
10000,
141142
"number of files to parse before turning the GC on",
142143
)
144+
flags.IntVar(
145+
&processor.FileListQueueSize,
146+
"file-list-queue-size",
147+
runtime.NumCPU(),
148+
"the size of the queue of files found and ready to be read into memory",
149+
)
150+
flags.IntVar(
151+
&processor.FileProcessJobWorkers,
152+
"file-process-job-workers",
153+
runtime.NumCPU(),
154+
"number of goroutine workers that process files collecting stats",
155+
)
156+
flags.IntVar(
157+
&processor.FileSummaryJobQueueSize,
158+
"file-summary-job-queue-size",
159+
runtime.NumCPU(),
160+
"the size of the queue used to hold processed file statistics before formatting",
161+
)
162+
flags.IntVar(
163+
&processor.DirectoryWalkerJobWorkers,
164+
"directory-walker-job-workers",
165+
8,
166+
"controls the maximum number of workers which will walk the directory tree",
167+
)
143168
flags.StringVarP(
144169
&processor.Format,
145170
"format",

processor/processor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ var FileProcessJobWorkers = runtime.NumCPU() * 4
165165
// FileSummaryJobQueueSize is the queue used to hold processed file statistics before formatting
166166
var FileSummaryJobQueueSize = runtime.NumCPU()
167167

168+
// DirectoryWalkerJobWorkers is the number of workers which will walk the directory tree
169+
var DirectoryWalkerJobWorkers = 8
170+
168171
// AllowListExtensions is a list of extensions which are allowed to be processed
169172
var AllowListExtensions = []string{}
170173

@@ -609,6 +612,7 @@ func Process() {
609612
fileWalker.IgnoreGitModules = GitModuleIgnore
610613
fileWalker.IncludeHidden = true
611614
fileWalker.ExcludeDirectory = PathDenyList
615+
fileWalker.SetConcurrency(DirectoryWalkerJobWorkers)
612616

613617
for _, exclude := range Exclude {
614618
regexpResult, err := regexp.Compile(exclude)

0 commit comments

Comments
 (0)