Skip to content

Commit d9e8743

Browse files
Robert Grossefacebook-github-bot
authored andcommitted
Log number of facts during scip encoding
Reviewed By: josh-gordon-fb Differential Revision: D78517774 fbshipit-source-id: ce6a496fe013116af7bff99dbf8a903c56132dcc
1 parent a3f20db commit d9e8743

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

glean/lang/scip/indexer/scip_to_glean/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ fn build_json(args: BuildJsonArgs) -> Result<()> {
107107
args.root_prefix.as_deref(),
108108
)?;
109109

110+
let output_facts = env.output();
111+
info!("Found {} facts total", output_facts.total_facts_count());
110112
let shards = if let Some(shard_size) = args.shard {
111-
let shards = env.output().shard(shard_size);
113+
let shards = output_facts.shard(shard_size);
112114
// pad the output files for correct numerical sorting
113115
let padding = shards.len().to_string().len();
114116
shards
@@ -122,7 +124,7 @@ fn build_json(args: BuildJsonArgs) -> Result<()> {
122124
})
123125
.collect()
124126
} else {
125-
vec![(args.output, env.output())]
127+
vec![(args.output, output_facts)]
126128
};
127129

128130
let num_files = shards.len();

glean/lang/scip/indexer/scip_to_glean/src/output.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,24 @@ impl GleanJSONOutput {
255255
})
256256
}
257257

258+
pub fn total_facts_count(&self) -> usize {
259+
self.src_files.len()
260+
+ self.file_langs.len()
261+
+ self.documentation.len()
262+
+ self.symbol_documentation.len()
263+
+ self.file_ranges.len()
264+
+ self.symbols.len()
265+
+ self.definitions.len()
266+
+ self.references.len()
267+
+ self.local_names.len()
268+
+ self.symbol_names.len()
269+
+ self.is_implementation.len()
270+
+ self.symbol_kinds.len()
271+
+ self.metadata.len()
272+
+ self.display_names.len()
273+
+ self.display_name_symbols.len()
274+
}
275+
258276
/// Consumes self, returns a list of GleanJSONOutput shards that are approximately of size `shard_size`
259277
/// The shards are complete SCIP subgraphs, per the SCIP schema definition
260278
/// This facilitates smaller writes to Glean without global, stateful keys

0 commit comments

Comments
 (0)