@@ -135,7 +135,10 @@ impl dyn Database {
135135}
136136
137137#[ cfg( feature = "salsa_unstable" ) ]
138- pub use memory_usage:: { IngredientInfo , SlotInfo } ;
138+ pub use memory_usage:: IngredientInfo ;
139+
140+ #[ cfg( feature = "salsa_unstable" ) ]
141+ pub ( crate ) use memory_usage:: { MemoInfo , SlotInfo } ;
139142
140143#[ cfg( feature = "salsa_unstable" ) ]
141144mod memory_usage {
@@ -171,8 +174,8 @@ mod memory_usage {
171174 /// Returns information about any memoized Salsa queries.
172175 ///
173176 /// The returned map holds memory usage information for memoized values of a given query, keyed
174- /// by its `(input, output)` type names .
175- pub fn queries_info ( & self ) -> HashMap < ( & ' static str , & ' static str ) , IngredientInfo > {
177+ /// by the query function name .
178+ pub fn queries_info ( & self ) -> HashMap < & ' static str , IngredientInfo > {
176179 let mut queries = HashMap :: new ( ) ;
177180
178181 for input_ingredient in self . zalsa ( ) . ingredients ( ) {
@@ -181,17 +184,15 @@ mod memory_usage {
181184 } ;
182185
183186 for input in input_info {
184- for output in input. memos {
185- let info = queries
186- . entry ( ( input. debug_name , output. debug_name ) )
187- . or_insert ( IngredientInfo {
188- debug_name : output. debug_name ,
189- ..Default :: default ( )
190- } ) ;
187+ for memo in input. memos {
188+ let info = queries. entry ( memo. debug_name ) . or_insert ( IngredientInfo {
189+ debug_name : memo. output . debug_name ,
190+ ..Default :: default ( )
191+ } ) ;
191192
192193 info. count += 1 ;
193- info. size_of_fields += output. size_of_fields ;
194- info. size_of_metadata += output. size_of_metadata ;
194+ info. size_of_fields += memo . output . size_of_fields ;
195+ info. size_of_metadata += memo . output . size_of_metadata ;
195196 }
196197 }
197198 }
@@ -236,6 +237,12 @@ mod memory_usage {
236237 pub ( crate ) debug_name : & ' static str ,
237238 pub ( crate ) size_of_metadata : usize ,
238239 pub ( crate ) size_of_fields : usize ,
239- pub ( crate ) memos : Vec < SlotInfo > ,
240+ pub ( crate ) memos : Vec < MemoInfo > ,
241+ }
242+
243+ /// Memory usage information about a particular memo.
244+ pub struct MemoInfo {
245+ pub ( crate ) debug_name : & ' static str ,
246+ pub ( crate ) output : SlotInfo ,
240247 }
241248}
0 commit comments