double recent_major_pagefaults() const {
#ifndef _WIN32
    if (!running) return 0;
    rusage now_usage;
    measure_usage(now_usage);
    return now_usage.ru_majflt - then_usage.ru_majflt;
#else
    return 0;  // TODO: implement Win32 version
#endif
  }
  double recent_system_time() const {
#ifndef _WIN32
    if (!running) return 0;
    rusage now_usage;
    measure_usage(now_usage);
    return elapsed_sec(now_usage.ru_stime, then_usage.ru_stime);
#else
    return 0;  // TODO: implement Win32 version
#endif
  }
Beispiel #3
0
void ipc_dbg_measure_throughput(unsigned long unused)
{
#ifdef CONFIG_MODEM_M6718_SPI_ENABLE_FEATURE_THROUGHPUT_MEASUREMENT
	u32 tx_bps_0, tx_bps_1;
	u32 rx_bps_0, rx_bps_1;
	int pc0, pc1;

	tx_bps_0 = tx_bps_1 = 0;
	rx_bps_0 = rx_bps_1 = 0;

	/* link0 */
	tx_bps_0 = (l1_context.device_context[0].tx_bytes * 8) /
		CONFIG_MODEM_M6718_SPI_SET_THROUGHPUT_FREQUENCY;
	rx_bps_0 = (l1_context.device_context[0].rx_bytes * 8) /
		CONFIG_MODEM_M6718_SPI_SET_THROUGHPUT_FREQUENCY;
	l1_context.device_context[0].tx_bytes = 0;
	l1_context.device_context[0].rx_bytes = 0;
	pc0 = measure_usage(&l1_context.device_context[0]);
#if IPC_NBR_SUPPORTED_SPI_LINKS > 0
	/* link1 */
	tx_bps_1 = (l1_context.device_context[1].tx_bytes * 8) /
		CONFIG_MODEM_M6718_SPI_SET_THROUGHPUT_FREQUENCY;
	rx_bps_1 = (l1_context.device_context[1].rx_bytes * 8) /
		CONFIG_MODEM_M6718_SPI_SET_THROUGHPUT_FREQUENCY;
	l1_context.device_context[1].tx_bytes = 0;
	l1_context.device_context[1].rx_bytes = 0;
	pc1 = measure_usage(&l1_context.device_context[1]);
#endif

	pr_info("IPC THROUGHPUT (bit/s): "
		"link0 TX:%8d RX:%8d %3d%% "
		"link1 TX:%8d RX:%8d %3d%%\n",
		tx_bps_0, rx_bps_0, pc0,
		tx_bps_1, rx_bps_1, pc1);

	/* restart the measurement timer */
	l1_context.tp_timer.expires = jiffies +
		(CONFIG_MODEM_M6718_SPI_SET_THROUGHPUT_FREQUENCY * HZ);
	add_timer(&l1_context.tp_timer);
#endif
}