Wideband autonomous SDR analysis engine forked from sdr-visual-suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
2.1KB

  1. package main
  2. import (
  3. "fmt"
  4. "sdr-wideband-suite/internal/demod/gpudemod"
  5. "sdr-wideband-suite/internal/telemetry"
  6. )
  7. func observeStreamingComparison(coll *telemetry.Collector, oracle gpudemod.StreamingExtractResult, prod gpudemod.StreamingExtractResult) {
  8. if coll == nil {
  9. return
  10. }
  11. metrics, stats := gpudemod.CompareOracleAndGPUHostOracle(oracle, prod)
  12. tags := telemetry.TagsFromPairs("signal_id", fmt.Sprintf("%d", oracle.SignalID), "path", "streaming_compare")
  13. coll.SetGauge("streaming.compare.n_out", float64(metrics.NOut), tags)
  14. coll.SetGauge("streaming.compare.phase_count", float64(metrics.PhaseCount), tags)
  15. coll.SetGauge("streaming.compare.history_len", float64(metrics.HistoryLen), tags)
  16. coll.Observe("streaming.compare.ref_max_abs_err", metrics.RefMaxAbsErr, tags)
  17. coll.Observe("streaming.compare.ref_rms_err", metrics.RefRMSErr, tags)
  18. coll.SetGauge("streaming.compare.compare_count", float64(stats.Count), tags)
  19. coll.SetGauge("streaming.compare.oracle_rate", float64(oracle.Rate), tags)
  20. coll.SetGauge("streaming.compare.production_rate", float64(prod.Rate), tags)
  21. coll.SetGauge("streaming.compare.oracle_output_len", float64(len(oracle.IQ)), tags)
  22. coll.SetGauge("streaming.compare.production_output_len", float64(len(prod.IQ)), tags)
  23. if len(oracle.IQ) > 0 {
  24. oracleStats := computeIQHeadStats(oracle.IQ, 64)
  25. coll.Observe("streaming.compare.oracle_head_mean_mag", oracleStats.meanMag, tags)
  26. coll.Observe("streaming.compare.oracle_head_max_step", oracleStats.maxStep, tags)
  27. }
  28. if len(prod.IQ) > 0 {
  29. prodStats := computeIQHeadStats(prod.IQ, 64)
  30. coll.Observe("streaming.compare.production_head_mean_mag", prodStats.meanMag, tags)
  31. coll.Observe("streaming.compare.production_head_max_step", prodStats.maxStep, tags)
  32. }
  33. coll.Event("streaming_compare_snapshot", "info", "streaming comparison snapshot", tags, map[string]any{
  34. "oracle_rate": oracle.Rate,
  35. "production_rate": prod.Rate,
  36. "oracle_output_len": len(oracle.IQ),
  37. "production_output_len": len(prod.IQ),
  38. "ref_max_abs_err": metrics.RefMaxAbsErr,
  39. "ref_rms_err": metrics.RefRMSErr,
  40. "compare_count": stats.Count,
  41. })
  42. }