-
Notifications
You must be signed in to change notification settings - Fork 18
Enhance state size analysis tool for more stats #99
base: main
Are you sure you want to change the base?
Conversation
| kvTotalSize := keySize + valueSize | ||
| percentage := 0.0 | ||
| if stats.totalSize > 0 { | ||
| percentage = float64(kvTotalSize) / float64(stats.totalSize) * 100 |
Check notice
Code scanning / CodeQL
Floating point arithmetic Note
| kvTotalSize := keySize + valueSize | ||
| percentage := 0.0 | ||
| if stats.totalSize > 0 { | ||
| percentage = float64(kvTotalSize) / float64(stats.totalSize) * 100 |
Check notice
Code scanning / CodeQL
Floating point arithmetic Note
| for _, entry := range stats.contractSizes { | ||
| sortedContracts = append(sortedContracts, *entry) | ||
| } |
Check warning
Code scanning / CodeQL
Iteration over map Warning
| for _, ps := range projectSizes { | ||
| projList = append(projList, *ps) | ||
| } |
Check warning
Code scanning / CodeQL
Iteration over map Warning
| for _, c := range stats.contractSizes { | ||
| size := c.TotalSize | ||
| switch { | ||
| case size < 1*KB: | ||
| lt1KBCount++ | ||
| lt1KBSizeBytes += size | ||
| case size >= 1*KB && size < 1*MB: | ||
| _1KBto1MBCount++ | ||
| _1KBto1MBSizeBytes += size | ||
| case size >= 1*MB && size < 10*MB: | ||
| _1MBto10MBCount++ | ||
| _1MBto10MBSizeBytes += size | ||
| case size >= 10*MB && size <= 100*MB: | ||
| _10MBto100Count++ | ||
| _10MBto100SizeBytes += size | ||
| default: // > 100MB | ||
| gt100MBCount++ | ||
| gt100MBSizeBytes += size | ||
| } | ||
| } |
Check warning
Code scanning / CodeQL
Iteration over map Warning
| countPct := float64(count) / float64(total) * 100 | ||
| sizePct := 0.0 | ||
| if sumSizeBytes > 0 { | ||
| sizePct = float64(sizeBytes) / float64(sumSizeBytes) * 100 |
Check notice
Code scanning / CodeQL
Floating point arithmetic Note
| countPct := float64(count) / float64(total) * 100 | ||
| sizePct := 0.0 | ||
| if sumSizeBytes > 0 { | ||
| sizePct = float64(sizeBytes) / float64(sumSizeBytes) * 100 |
Check notice
Code scanning / CodeQL
Floating point arithmetic Note
| // Totals row and module share | ||
| fmt.Printf("%-20s %10d %8.2f %15d %7.2f\n", "Total", total, 100.00, sumSizeBytes/MB, 100.00) | ||
| if stats.totalSize > 0 { | ||
| share := float64(sumSizeBytes) / float64(stats.totalSize) * 100 |
Check notice
Code scanning / CodeQL
Floating point arithmetic Note
| // Totals row and module share | ||
| fmt.Printf("%-20s %10d %8.2f %15d %7.2f\n", "Total", total, 100.00, sumSizeBytes/MB, 100.00) | ||
| if stats.totalSize > 0 { | ||
| share := float64(sumSizeBytes) / float64(stats.totalSize) * 100 |
Check notice
Code scanning / CodeQL
Floating point arithmetic Note
| for proj, addrs := range ProjectContracts { | ||
| for _, a := range addrs { | ||
| key := strings.ToLower(a) // keep "0x" prefix | ||
| addrToProjects[key] = append(addrToProjects[key], proj) | ||
| } | ||
| } |
Check warning
Code scanning / CodeQL
Iteration over map Warning
Describe your changes and provide context
Testing performed to validate your change