int main(int argc, char ** argv) { bool success_all = true; bool unbalance_check = true; struct busy_data busy; const char * exec_name = argv[0]; os_init(OS_INIT_NOFREQUENCY); printf("# %s Created by Olivier Cozette <*****@*****.**>\n# Copyright (C) 2013 ARM Limited\n", argv[0]); if ((argc > 1) && (strcmp(argv[1], "NO_BALANCE_CHECK") == 0)) { argv++; argc--; unbalance_check = false; } if (argc < 5) { printf("#Usage %s [NO_BALANCE_CHECK] TOTAL_SEQUENTIAL_TIME RUNNING_TIME SLEEPING_TIME NICE_PID0 [NICE_PID1] ...\n", exec_name); printf("#\tif NO_BALANCED_CHECK is given, even unbalanced thread won't raise a FAILED\n"); os_cleanup(); exit(1); } if (!main_init(&busy, argc, argv)) { printf("# error :%s\n", busy.error_str); main_cleanup(&busy); os_cleanup(); exit(1); } if (!main_launch(&busy)) success_all = false; if (!main_wait(&busy)) success_all = false; if (success_all) printf("SUCCESS before checking if tasks were well balanced\n"); if (!main_check(&busy)) { if (unbalance_check) success_all = false; else printf("#Seen as unbalanced or not using all the cpu time, but this doesn't affect the result\n"); } main_cleanup(&busy); os_cleanup(); if (!success_all) { printf("FAILED\n"); exit(1); } printf("SUCCESS\n"); return 0; }
JNIEXPORT jboolean JNICALL Java_com_cs4911_video_1editor_android_BandwidthMeasurement_launchBandwidthTest(JNIEnv *jenv, jobject obj, jstring serverIp) { if (gTest) iperf_free_test(gTest); gTest = NULL; jboolean is_copy; const jbyte *server_ip_j = (*jenv)->GetStringUTFChars(jenv, serverIp, &is_copy) ; char *server_ip = malloc(strlen(server_ip_j) + 1); strncpy(server_ip, server_ip_j, strlen(server_ip_j)); server_ip[strlen(server_ip_j)] = '\0'; LOGI("server ip from main: %s", server_ip); char *argv[] = {"iperf", "-c", server_ip}; gTest = main_launch(3, argv); if (!gTest) return 1; return 0; }