// デバッグ用変数群
#if defined (DEBUG_QUEUEDEPTH)
-static int debug_counter = 0;
static int debug_queue_level = 0;
static int debug_queue_max = INT_MIN;
static int debug_queue_min = INT_MAX;
} // RX-IF DMAバッファ内部のデータを処理
-#ifdef DEBUG_QUEUEDEPTH
- debug_counter ++;
- static int debug_total = 0;
- if ( debug_counter > 30000 )
- {
- debug_counter = 0;
- syslog( LOG_NOTICE, "%8d: que depth max : %d, min : %d ", debug_total++, debug_queue_max, debug_queue_min);
- }
-#endif // DEBUG_QUEUEDEPTH
} while (1);
*pDMA2_NEXT_DESC_PTR = &framework.tx_dma_dsc[0];
}
+
+/**
+ * \brief デバッグ用モニタ・タスク
+ * \param exinf cfgファイルに記述されたパラメタを受け取る引数。使っていない。
+ * \details 一定時間ごとにシステム状態をモニターする。通常は使っていないが、
+ * 開発時に各種システム量を計算、取得するために動かす低順位タスクである。
+ */
+
+void monitor_task(VP_INT exinf)
+{
+
+ while(1)
+ {
+#ifdef DEBUG_DSPLOAD
+ unsigned int cycle_start, cycle_end, total_idle_cycle, total_cycle;
+ {// DSP負荷の計算(前処理)
+
+ idle_cycle = 0;
+ asm volatile ("r0 = cycles;%0 = r0;" : "=d"(cycle_start) : : "R0");
+ }
+#endif // DEBUG_DSPLOAD
+
+ tslp_tsk(1000); // 1秒待つ
+
+#ifdef DEBUG_DSPLOAD
+ {// DSP負荷の計算(後処理)
+ asm volatile ("r0 = cycles;%0 = r0;" : "=d"(cycle_end) : : "R0");
+
+ // ここまでの通算時間を取得する
+ total_cycle = cycle_end - cycle_start;
+ // ここまでの通算アイドル時間を取得する
+ total_idle_cycle = idle_cycle;
+
+
+ // 計算しやすいようにスケーリング
+ total_cycle >>= 16;
+ total_idle_cycle >>=16;
+
+ syslog(LOG_NOTICE, "DSP Load : %d%%", (total_cycle - total_idle_cycle) * 100 / total_cycle);
+ }
+#endif // DEBUG_DSPLOAD
+
+#ifdef DEBUG_QUEUEDEPTH
+ { // AF TASK, RX IF TAXK間のキューの深さを報告する
+
+ syslog( LOG_NOTICE, "Queue depth max : %d, min : %d ", debug_queue_max, debug_queue_min);
+ }
+#endif // DEBUG_QUEUEDEPTH
+
+ }
+}