(ctx context.Context, dbContext *db.DatabaseContext)
| 291 | } |
| 292 | |
| 293 | func printEndofTestStatsFile(ctx context.Context, dbContext *db.DatabaseContext) { |
| 294 | // Print the csv file to stdout |
| 295 | dbContext.UpdateCalculatedStats(ctx) |
| 296 | dbStats := dbContext.DbStats |
| 297 | // calculate here avg time to cache seq in ms |
| 298 | count := dbStats.Database().DCPCachingCount.Value() |
| 299 | timeNano := dbStats.Database().DCPCachingTime.Value() |
| 300 | avgTimeNano := float64(timeNano) / float64(count) |
| 301 | avgTimeMs := avgTimeNano / 1e6 |
| 302 | timeMS := timeNano / 1e6 |
| 303 | |
| 304 | _, _ = fmt.Fprintf(os.Stdout, "timestamp,") |
| 305 | _, _ = fmt.Fprintf(os.Stdout, "high_seq_feed,") |
| 306 | _, _ = fmt.Fprintf(os.Stdout, "pending_seq_len,") |
| 307 | _, _ = fmt.Fprintf(os.Stdout, "high_seq_stable,") |
| 308 | _, _ = fmt.Fprintf(os.Stdout, "current_skipped_seq_count,") |
| 309 | _, _ = fmt.Fprintf(os.Stdout, "num_skipped_seqs,") |
| 310 | _, _ = fmt.Fprintf(os.Stdout, "skipped_sequence_skip_list_nodes,") |
| 311 | _, _ = fmt.Fprintf(os.Stdout, "dcp_caching_count,") |
| 312 | _, _ = fmt.Fprintf(os.Stdout, "dcp_caching_time,") |
| 313 | _, _ = fmt.Fprintf(os.Stdout, "avg_time_per_seq_ms") |
| 314 | _, _ = fmt.Fprintf(os.Stdout, "\n") |
| 315 | |
| 316 | // print end of run stats |
| 317 | _, _ = fmt.Fprintf(os.Stdout, "%d,", time.Now().Unix()) |
| 318 | _, _ = fmt.Fprintf(os.Stdout, "%d,", dbStats.Database().HighSeqFeed.Value()) |
| 319 | _, _ = fmt.Fprintf(os.Stdout, "%d,", dbStats.Cache().PendingSeqLen.Value()) |
| 320 | _, _ = fmt.Fprintf(os.Stdout, "%d,", dbStats.Cache().HighSeqStable.Value()) |
| 321 | _, _ = fmt.Fprintf(os.Stdout, "%d,", dbStats.Cache().NumCurrentSeqsSkipped.Value()) |
| 322 | _, _ = fmt.Fprintf(os.Stdout, "%d,", dbStats.Cache().NumSkippedSeqs.Value()) |
| 323 | _, _ = fmt.Fprintf(os.Stdout, "%d,", dbStats.Cache().SkippedSequenceSkiplistNodes.Value()) |
| 324 | _, _ = fmt.Fprintf(os.Stdout, "%d,", count) |
| 325 | _, _ = fmt.Fprintf(os.Stdout, "%d,", timeMS) |
| 326 | _, _ = fmt.Fprintf(os.Stdout, "%f", avgTimeMs) |
| 327 | _, _ = fmt.Fprintf(os.Stdout, "\n") |
| 328 | } |
| 329 | |
| 330 | func csvStats(ctx context.Context, dbContext *db.DatabaseContext) { |
| 331 | ticker := time.NewTicker(1 * time.Second) |
no test coverage detected