(snapshot *Snapshot)
| 1488 | } |
| 1489 | |
| 1490 | func (s *Session) logCacheStats(snapshot *Snapshot) { |
| 1491 | var parseCacheSize int |
| 1492 | var extendedConfigCount int |
| 1493 | if s.logger.IsVerbose() { |
| 1494 | s.parseCache.entries.Range(func(_ ParseCacheKey, _ *refCountCacheEntry[*ast.SourceFile]) bool { |
| 1495 | parseCacheSize++ |
| 1496 | return true |
| 1497 | }) |
| 1498 | s.extendedConfigCache.entries.Range(func(_ tspath.Path, _ *ownerCacheEntry[*ExtendedConfigCacheEntry]) bool { |
| 1499 | extendedConfigCount++ |
| 1500 | return true |
| 1501 | }) |
| 1502 | } |
| 1503 | s.logger.Log("\n======== Cache Statistics ========") |
| 1504 | s.logger.Logf("Open file count: %6d", len(snapshot.fs.overlays)) |
| 1505 | s.logger.Logf("Cached disk files: %6d", len(snapshot.fs.diskFiles)) |
| 1506 | s.logger.Logf("Realpath aliases: %6d", len(snapshot.fs.nodeModulesRealpathAliases)) |
| 1507 | s.logger.Logf("Project count: %6d", len(snapshot.ProjectCollection.Projects())) |
| 1508 | s.logger.Logf("Config count: %6d", len(snapshot.ConfigFileRegistry.configs)) |
| 1509 | if s.logger.IsVerbose() { |
| 1510 | s.logger.Logf("Parse cache size: %6d", parseCacheSize) |
| 1511 | s.logger.Logf("Program count: %6d", s.programCounter.Len()) |
| 1512 | s.logger.Logf("Extended config cache size: %6d", extendedConfigCount) |
| 1513 | |
| 1514 | s.logger.Log("Auto Imports:") |
| 1515 | autoImportStats := snapshot.AutoImportRegistry().GetCacheStats() |
| 1516 | s.logger.Logf("\tUnique packages (by realpath): %d", autoImportStats.UniquePackageCount) |
| 1517 | if len(autoImportStats.ProjectBuckets) > 0 { |
| 1518 | s.logger.Log("\tProject buckets:") |
| 1519 | for _, bucket := range autoImportStats.ProjectBuckets { |
| 1520 | s.logger.Logf("\t\t%s%s:", bucket.Path, core.IfElse(bucket.State.Dirty(), " (dirty)", "")) |
| 1521 | s.logger.Logf("\t\t\tFiles: %d", bucket.FileCount) |
| 1522 | s.logger.Logf("\t\t\tExports: %d", bucket.ExportCount) |
| 1523 | } |
| 1524 | } |
| 1525 | if len(autoImportStats.NodeModulesBuckets) > 0 { |
| 1526 | s.logger.Log("\tnode_modules buckets:") |
| 1527 | for _, bucket := range autoImportStats.NodeModulesBuckets { |
| 1528 | s.logger.Logf("\t\t%s%s:", bucket.Path, core.IfElse(bucket.State.Dirty(), " (dirty)", "")) |
| 1529 | for packageName := range bucket.State.DirtyPackages().Keys() { |
| 1530 | s.logger.Logf("\t\t\tNeeds granular update: %s", packageName) |
| 1531 | } |
| 1532 | if bucket.DependencyNames != nil { |
| 1533 | s.logger.Logf("\t\t\tCollected packages: %d", bucket.DependencyNames.Len()) |
| 1534 | } else { |
| 1535 | s.logger.Logf("\t\t\tCollected packages: all, due to no package.json!") |
| 1536 | } |
| 1537 | s.logger.Logf("\t\t\tTotal packages: %d", bucket.PackageNames.Len()) |
| 1538 | s.logger.Logf("\t\t\tFiles: %d", bucket.FileCount) |
| 1539 | s.logger.Logf("\t\t\tExports: %d", bucket.ExportCount) |
| 1540 | if bucket.State.RecursiveSearchPackages() == nil { |
| 1541 | s.logger.Log("\t\t\tRecursive search: all") |
| 1542 | } else if bucket.State.RecursiveSearchPackages().Len() > 0 { |
| 1543 | s.logger.Logf("\t\t\tRecursive search: %d packages", bucket.State.RecursiveSearchPackages().Len()) |
| 1544 | } else { |
| 1545 | s.logger.Log("\t\t\tRecursive search: none") |
| 1546 | } |
| 1547 | } |
no test coverage detected