コード例 #1
0
ファイル: main.c プロジェクト: benpicco/RIOT-old
void send_tcp_bandwidth_test(char *str)
	{
	timex_t start, end, total;
	double secs;

	int i = 0, count;
	char command[80];
//	char msg_string[] = "abcdefghijklmnopqrstuvwxyz0123456789!-";
	char msg_string[] = "abcdefghijklmnopqrstuvwxyz0123456789!-=/%$";

	sscanf(str, "tcp_bw %i", &count);
	ltc4150_start();
	printf("Start power: %f\n", ltc4150_get_total_mAh());
	start = vtimer_now();
	for (i = 0; i < count; i++)
		{
		sprintf(command, "send_tcp %s%.5i", msg_string, i);
		send_tcp_msg(command);
		}
	end = vtimer_now();
	total = timex_sub(end, start);
	secs = total.microseconds / 1000000.0f;
	printf("Used power: %f\n", ltc4150_get_total_Joule());
	printf("Start: %lu, End: %lu, Total: %lu\n", start.microseconds, end.microseconds, total.microseconds);
	printf("Time: %f seconds, Bandwidth: %f byte/second\n", secs, (count*48)/secs);
	}
コード例 #2
0
ファイル: sc_ltc4150.c プロジェクト: 4120976/RIOT
void _get_current_handler(int argc, char **argv)
{
    (void) argc;
    (void) argv;

    printf("Power usage: %.4f mA (%.4f mA avg/ %.4f mAh total / %i usec)\n",
           ltc4150_get_current_mA(), ltc4150_get_avg_mA(), ltc4150_get_total_mAh(), ltc4150_get_interval());
}
コード例 #3
0
ファイル: main.c プロジェクト: SilkeRieger/projects
int main(void)
{
    ltc4150_start();

    hwtimer_tick_id = hwtimer_set(tick_ticks,
                                  test_ltc_tick,
                                  (void *) thread_pid);

    while (1) {
        thread_sleep();
        printf("Power usage: %.4f mA (%.4f mA avg/ %.4f mAh total / %i usec)\n",
                ltc4150_get_current_mA(), ltc4150_get_avg_mA(),
                ltc4150_get_total_mAh(), ltc4150_get_interval());
    }

    return 0;
}
コード例 #4
0
ファイル: sc_ltc4150.c プロジェクト: benpicco/RIOT-old
void _get_current_handler(char* unused) {
	printf("Power usage: %.4f mA (%.4f mA avg/ %.4f mAh total / %i usec)\n", ltc4150_get_current_mA(), ltc4150_get_avg_mA(), ltc4150_get_total_mAh(), ltc4150_get_interval());
}