Skip to content

Commit 9584dc0

Browse files
committed
log node/edge count when loading CPGs
1 parent b32da21 commit 9584dc0

File tree

1 file changed

+7
-2
lines changed
  • codepropertygraph/src/main/scala/io/shiftleft/codepropertygraph/cpgloading

1 file changed

+7
-2
lines changed

codepropertygraph/src/main/scala/io/shiftleft/codepropertygraph/cpgloading/CpgLoader.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ object CpgLoader {
4040
load(absolutePath, persistTo = path.resolveSibling(s"${path.getFileName}.fg"))
4141
} else {
4242
// assuming it's flatgraph format
43-
Cpg.withStorage(absolutePath)
43+
val cpg = Cpg.withStorage(absolutePath)
44+
logger.debug(s"Loaded Cpg with ${cpg.graph.nodeCount} nodes and ${cpg.graph.edgeCount} edges")
45+
cpg
4446
}
4547
}
4648

@@ -58,7 +60,7 @@ object CpgLoader {
5860
if (persistTo != from)
5961
Files.deleteIfExists(persistTo)
6062

61-
if (!Files.exists(absolutePath)) {
63+
val cpg = if (!Files.exists(absolutePath)) {
6264
throw new FileNotFoundException(s"given input file $absolutePath does not exist")
6365
} else if (isProtoFormat(absolutePath)) {
6466
logger.debug(s"Converting $from from proto cpg into new flatgraph storage: $persistTo")
@@ -73,6 +75,9 @@ object CpgLoader {
7375
s"unknown file format - we probed the first bytes but it didn't look like one of our known formats (proto.zip, flatgraph, overflowdb)"
7476
)
7577
}
78+
logger.debug(s"Loaded Cpg with ${cpg.graph.nodeCount} nodes and ${cpg.graph.edgeCount} edges")
79+
80+
cpg
7681
}
7782

7883
/** Determine whether the CPG is a legacy (proto) CPG */

0 commit comments

Comments
 (0)