File tree 2 files changed +26
-1
lines changed
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,10 @@ impl FileMetadataCache {
67
67
}
68
68
}
69
69
70
+ pub fn size ( & self ) -> usize {
71
+ self . cache . entry_count ( ) as usize
72
+ }
73
+
70
74
pub fn get < T : Send + Sync + ' static > ( & self , path : & Path ) -> Option < Arc < T > > {
71
75
self . cache
72
76
. get ( & ( path. to_owned ( ) , TypeId :: of :: < T > ( ) ) )
Original file line number Diff line number Diff line change @@ -31,7 +31,28 @@ pub struct Session {
31
31
32
32
impl std:: fmt:: Debug for Session {
33
33
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
34
- write ! ( f, "Session()" )
34
+ f. debug_struct ( "Session" )
35
+ . field (
36
+ "index_cache" ,
37
+ & format ! (
38
+ "IndexCache(items={}, size_bytes={})" ,
39
+ self . index_cache. get_size( ) ,
40
+ self . index_cache. deep_size_of( )
41
+ ) ,
42
+ )
43
+ . field (
44
+ "file_metadata_cache" ,
45
+ & format ! (
46
+ "FileMetadataCache(items={}, size_bytes={})" ,
47
+ self . file_metadata_cache. size( ) ,
48
+ self . file_metadata_cache. deep_size_of( )
49
+ ) ,
50
+ )
51
+ . field (
52
+ "index_extensions" ,
53
+ & self . index_extensions . keys ( ) . collect :: < Vec < _ > > ( ) ,
54
+ )
55
+ . finish ( )
35
56
}
36
57
}
37
58
You can’t perform that action at this time.
0 commit comments