Revision 3e8094a0 core/src/aos_system.c

View differences:

core/src/aos_system.c
667 667
    sum += thd->stats.cumulative;
668 668
    thd = chRegNextThread(thd);
669 669
  } while (thd);
670
  sum += ch.kernel_stats.m_crit_thd.cumulative + ch.kernel_stats.m_crit_isr.cumulative;
670
  sum += ch.kernel_stats.m_crit_thd.cumulative;
671
  sum += ch.kernel_stats.m_crit_isr.cumulative;
671 672

  
672
  // calculate and retreive cpu load per thread
673
  // retreive, calculate and print performance measures
673 674
  chprintf(stream, "threads & critical zones:\n");
674 675
  thd = chRegFirstThread();
675 676
  do {
676 677
    chprintf(stream, "\t%22s: %6.2f%%\n",
677 678
             (thd->name != NULL) ? thd->name : "<unnamed thread>",
678
             (float)thd->stats.cumulative / (float)sum * 100.f);
679
             (double)((float)thd->stats.cumulative / (float)sum * 100.f));
679 680
    thd = chRegNextThread(thd);
680 681
  } while (thd);
681 682
  chprintf(stream, "\t%22s: %6.2f%%\n",
682 683
           "thread critical zones",
683
           (float)ch.kernel_stats.m_crit_thd.cumulative / (float)sum * 100.f);
684
           (double)((float)ch.kernel_stats.m_crit_thd.cumulative / (float)sum * 100.f));
684 685
  chprintf(stream, "\t%22s: %6.2f%%\n",
685 686
           "ISR critical zones",
686
           (float)ch.kernel_stats.m_crit_isr.cumulative / (float)sum * 100.f);
687
           (double)((float)ch.kernel_stats.m_crit_isr.cumulative / (float)sum * 100.f));
687 688

  
688 689
  // retreive further real-time statistics
689 690
  chprintf(stream, "\nworst critical zones:\n");
690
  chprintf(stream, "\tthreads: %uus (%u clocks @ %uMHz)\n",
691
  chprintf(stream, "\tthreads: %uus (%u clock cycles)\n",
691 692
           RTC2US(SystemCoreClock, ch.kernel_stats.m_crit_thd.worst),
692
           ch.kernel_stats.m_crit_thd.worst,
693
           SystemCoreClock / 1000000);
694
  chprintf(stream, "\t   ISRs: %uus (%u clocks @ %uMHz)\n",
693
           ch.kernel_stats.m_crit_thd.worst);
694
  chprintf(stream, "\t   ISRs: %uus (%u clock cycles)\n",
695 695
           RTC2US(SystemCoreClock, ch.kernel_stats.m_crit_isr.worst),
696
           ch.kernel_stats.m_crit_isr.worst,
697
           SystemCoreClock / 1000000);
696
           ch.kernel_stats.m_crit_isr.worst);
698 697

  
699 698
  return 0;
700 699
}

Also available in: Unified diff