improve stats generation
This commit is contained in:
parent
0c9ad5bfd6
commit
a8177a1583
5 changed files with 61 additions and 20 deletions
|
|
@ -43,12 +43,14 @@ func writeStats(stats *Stats) {
|
|||
"started_at": stats.StartedAt.Format(time.RFC3339),
|
||||
"finished_at": finishedAt.Format(time.RFC3339),
|
||||
"duration_seconds": int(duration.Seconds()),
|
||||
"total_hosts": stats.TotalHosts,
|
||||
"hosts_with_icon": stats.HostsWithIcon,
|
||||
"hosts_no_icon": stats.HostsNoIcon,
|
||||
"convert_errors": stats.ConvertErrors.Load(),
|
||||
"bundles_created": stats.BundlesCreated,
|
||||
"total_bytes": stats.TotalBytes,
|
||||
"total_hosts": stats.TotalHosts,
|
||||
"hosts_with_icon": stats.HostsWithIcon,
|
||||
"hosts_no_icon": stats.HostsNoIcon,
|
||||
"bundled_with_icon": stats.BundledWithIcon.Load(),
|
||||
"bundled_no_icon": stats.BundledNoIcon.Load(),
|
||||
"convert_errors": stats.ConvertErrors.Load(),
|
||||
"bundles_created": stats.BundlesCreated,
|
||||
"total_bytes": stats.TotalBytes,
|
||||
}
|
||||
|
||||
os.MkdirAll("stats", 0755)
|
||||
|
|
|
|||
|
|
@ -27,13 +27,15 @@ type Config struct {
|
|||
}
|
||||
|
||||
type Stats struct {
|
||||
TotalHosts int
|
||||
HostsWithIcon int
|
||||
HostsNoIcon int
|
||||
BundlesCreated int
|
||||
ConvertErrors atomic.Int64
|
||||
TotalBytes int64
|
||||
StartedAt time.Time
|
||||
TotalHosts int
|
||||
HostsWithIcon int
|
||||
HostsNoIcon int
|
||||
BundlesCreated int
|
||||
ConvertErrors atomic.Int64
|
||||
BundledWithIcon atomic.Int64
|
||||
BundledNoIcon atomic.Int64
|
||||
TotalBytes int64
|
||||
StartedAt time.Time
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
|
@ -158,6 +160,14 @@ func main() {
|
|||
}
|
||||
wg.Wait()
|
||||
|
||||
for _, e := range pageEntries {
|
||||
if e.Icon != "" {
|
||||
stats.BundledWithIcon.Add(1)
|
||||
} else {
|
||||
stats.BundledNoIcon.Add(1)
|
||||
}
|
||||
}
|
||||
|
||||
entryBuf = append(entryBuf, pageEntries...)
|
||||
|
||||
// Write complete bundles from the buffer
|
||||
|
|
@ -226,6 +236,8 @@ func main() {
|
|||
fmt.Printf("Total hosts: %d\n", stats.TotalHosts)
|
||||
fmt.Printf("Hosts with icon: %d\n", stats.HostsWithIcon)
|
||||
fmt.Printf("Hosts without icon: %d\n", stats.HostsNoIcon)
|
||||
fmt.Printf("Bundled with icon: %d\n", stats.BundledWithIcon.Load())
|
||||
fmt.Printf("Bundled without icon: %d\n", stats.BundledNoIcon.Load())
|
||||
fmt.Printf("Convert errors: %d\n", stats.ConvertErrors.Load())
|
||||
fmt.Printf("Bundles created: %d\n", stats.BundlesCreated)
|
||||
fmt.Printf("Total size: %.1f MB\n", float64(stats.TotalBytes)/(1024*1024))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue