Moved a bunch more output strings to locale.[hc].
Этот коммит содержится в:
родитель
55ace3e28b
Коммит
558c9b8013
@ -425,15 +425,15 @@ iperf_on_connect(struct iperf_test *test)
|
||||
if (test->json_output)
|
||||
cJSON_AddItemToObject(test->json_start, "timestamp", iperf_json_printf("time: %s timesecs: %d", now_str, (int64_t) now_secs));
|
||||
else if (test->verbose)
|
||||
iprintf(test, "Time: %s\n", now_str);
|
||||
iprintf(test, report_time, now_str);
|
||||
|
||||
if (test->role == 'c') {
|
||||
if (test->json_output)
|
||||
cJSON_AddItemToObject(test->json_start, "connecting_to", iperf_json_printf("host: %s port: %d", test->server_hostname, (int64_t) test->server_port));
|
||||
else {
|
||||
iprintf(test, "Connecting to host %s, port %d\n", test->server_hostname, test->server_port);
|
||||
iprintf(test, report_connecting, test->server_hostname, test->server_port);
|
||||
if (test->reverse)
|
||||
iprintf(test, "Reverse mode, remote host %s is sending\n", test->server_hostname);
|
||||
iprintf(test, report_reverse, test->server_hostname);
|
||||
}
|
||||
} else {
|
||||
len = sizeof(sa);
|
||||
@ -441,22 +441,17 @@ iperf_on_connect(struct iperf_test *test)
|
||||
if (getsockdomain(test->ctrl_sck) == AF_INET) {
|
||||
sa_inP = (struct sockaddr_in *) &sa;
|
||||
inet_ntop(AF_INET, &sa_inP->sin_addr, ipr, sizeof(ipr));
|
||||
mapped_v4_to_regular_v4(ipr);
|
||||
port = ntohs(sa_inP->sin_port);
|
||||
if (test->json_output)
|
||||
cJSON_AddItemToObject(test->json_start, "accepted_connection", iperf_json_printf("host: %s port: %d", ipr, (int64_t) port));
|
||||
else
|
||||
iprintf(test, "Accepted connection from %s, port %d\n", ipr, port);
|
||||
} else {
|
||||
sa_in6P = (struct sockaddr_in6 *) &sa;
|
||||
inet_ntop(AF_INET6, &sa_in6P->sin6_addr, ipr, sizeof(ipr));
|
||||
mapped_v4_to_regular_v4(ipr);
|
||||
port = ntohs(sa_in6P->sin6_port);
|
||||
}
|
||||
mapped_v4_to_regular_v4(ipr);
|
||||
if (test->json_output)
|
||||
cJSON_AddItemToObject(test->json_start, "accepted_connection", iperf_json_printf("host: %s port: %d", ipr, (int64_t) port));
|
||||
else
|
||||
iprintf(test, "Accepted connection from %s, port %d\n", ipr, port);
|
||||
}
|
||||
iprintf(test, report_accepted, ipr, port);
|
||||
}
|
||||
if (test->json_output) {
|
||||
cJSON_AddStringToObject(test->json_start, "cookie", test->cookie);
|
||||
@ -468,7 +463,7 @@ iperf_on_connect(struct iperf_test *test)
|
||||
cJSON_AddIntToObject(test->json_start, "tcp_mss_default", opt);
|
||||
}
|
||||
} else if (test->verbose) {
|
||||
iprintf(test, " Cookie: %s\n", test->cookie);
|
||||
iprintf(test, report_cookie, test->cookie);
|
||||
if (test->protocol->id == SOCK_STREAM) {
|
||||
if (test->settings->mss)
|
||||
iprintf(test, " TCP MSS: %d\n", test->settings->mss);
|
||||
@ -1335,7 +1330,7 @@ connect_msg(struct iperf_stream *sp)
|
||||
if (sp->test->json_output)
|
||||
cJSON_AddItemToObject(sp->test->json_start, "connected", iperf_json_printf("socket: %d local_host: %s local_port: %d remote_host: %s remote_port: %d", (int64_t) sp->socket, ipl, (int64_t) lport, ipr, (int64_t) rport));
|
||||
else
|
||||
iprintf(sp->test, "[%3d] local %s port %d connected to %s port %d\n", sp->socket, ipl, lport, ipr, rport);
|
||||
iprintf(sp->test, report_connected, sp->socket, ipl, lport, ipr, rport);
|
||||
}
|
||||
|
||||
|
||||
@ -1714,7 +1709,7 @@ iperf_print_results(struct iperf_test *test)
|
||||
cJSON_AddItemToObject(test->json_end, "streams", json_summary_streams);
|
||||
} else {
|
||||
if (test->verbose)
|
||||
iprintf(test, "Test Complete. Summary Results:\n");
|
||||
iprintf(test, report_summary);
|
||||
if (test->protocol->id == Ptcp)
|
||||
if (test->sender_has_retransmits)
|
||||
iprintf(test, "%s", report_bw_retrans_header);
|
||||
@ -1787,7 +1782,7 @@ iperf_print_results(struct iperf_test *test)
|
||||
if (test->json_output)
|
||||
cJSON_AddItemToObject(json_summary_stream, "diskfile", iperf_json_printf("sent: %d size: %d percent: %d filename: %s", (int64_t) bytes_sent, (int64_t) sb.st_size, (int64_t) percent, test->diskfile_name));
|
||||
else
|
||||
iprintf(test, " Sent %s / %s (%d%%) of %s\n", ubuf, sbuf, percent, test->diskfile_name);
|
||||
iprintf(test, report_diskfile, ubuf, sbuf, percent, test->diskfile_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ client_omit_timer_proc(TimerClientData client_data, struct timeval *nowP)
|
||||
test->omitting = 0;
|
||||
iperf_reset_stats(test);
|
||||
if (test->verbose && !test->json_output && test->reporter_interval == 0)
|
||||
iprintf(test, "Finished omit period, starting real test\n");
|
||||
iprintf(test, "%s", report_omit_done);
|
||||
|
||||
/* Reset the timers. */
|
||||
if (test->stats_timer != NULL)
|
||||
@ -448,7 +448,7 @@ iperf_run_client(struct iperf_test * test)
|
||||
return -1;
|
||||
} else {
|
||||
iprintf(test, "\n");
|
||||
iprintf(test, "iperf Done.\n");
|
||||
iprintf(test, "%s", report_done);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -88,10 +88,10 @@ iperf_server_listen(struct iperf_test *test)
|
||||
if (test->settings->socket_bufsize > 0) {
|
||||
unit_snprintf(ubuf, UNIT_LEN, (double) x, 'A');
|
||||
if (!test->json_output)
|
||||
iprintf(test, "TCP window size: %s\n", ubuf);
|
||||
iprintf(test, report_window, ubuf);
|
||||
} else {
|
||||
if (!test->json_output)
|
||||
iprintf(test, "Using TCP Autotuning\n");
|
||||
iprintf(test, "%s", report_autotune);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -343,7 +343,7 @@ server_omit_timer_proc(TimerClientData client_data, struct timeval *nowP)
|
||||
test->omitting = 0;
|
||||
iperf_reset_stats(test);
|
||||
if (test->verbose && !test->json_output && test->reporter_interval == 0)
|
||||
iprintf(test, "Finished omit period, starting real test\n");
|
||||
iprintf(test, "%s", report_omit_done);
|
||||
|
||||
/* Reset the timers. */
|
||||
if (test->stats_timer != NULL)
|
||||
|
36
src/locale.c
36
src/locale.c
@ -176,6 +176,39 @@ const char test_start_bytes[] =
|
||||
* reports
|
||||
* ------------------------------------------------------------------- */
|
||||
|
||||
const char report_time[] =
|
||||
"Time: %s\n";
|
||||
|
||||
const char report_connecting[] =
|
||||
"Connecting to host %s, port %d\n";
|
||||
|
||||
const char report_reverse[] =
|
||||
"Reverse mode, remote host %s is sending\n";
|
||||
|
||||
const char report_accepted[] =
|
||||
"Accepted connection from %s, port %d\n";
|
||||
|
||||
const char report_cookie[] =
|
||||
" Cookie: %s\n";
|
||||
|
||||
const char report_connected[] =
|
||||
"[%3d] local %s port %d connected to %s port %d\n";
|
||||
|
||||
const char report_window[] =
|
||||
"TCP window size: %s\n";
|
||||
|
||||
const char report_autotune[] =
|
||||
"Using TCP Autotuning\n";
|
||||
|
||||
const char report_omit_done[] =
|
||||
"Finished omit period, starting real test\n";
|
||||
|
||||
const char report_diskfile[] =
|
||||
" Sent %s / %s (%d%%) of %s\n";
|
||||
|
||||
const char report_done[] =
|
||||
"iperf Done.\n";
|
||||
|
||||
const char report_read_lengths[] =
|
||||
"[%3d] Read lengths occurring in more than 5%% of reads:\n";
|
||||
|
||||
@ -201,6 +234,9 @@ const char report_bw_retrans_format[] =
|
||||
const char report_bw_udp_format[] =
|
||||
"[%3d] %6.2f-%-6.2f sec %ss %ss/sec %5.3f ms %d/%d (%.2g%%)\n";
|
||||
|
||||
const char report_summary[] =
|
||||
"Test Complete. Summary Results:\n";
|
||||
|
||||
const char report_sum_bw_format[] =
|
||||
"[SUM] %6.2f-%-6.2f sec %ss %ss/sec%s\n";
|
||||
|
||||
|
12
src/locale.h
12
src/locale.h
@ -30,6 +30,17 @@ extern const char wait_server_threads[] ;
|
||||
extern const char test_start_time[];
|
||||
extern const char test_start_bytes[];
|
||||
|
||||
extern const char report_time[] ;
|
||||
extern const char report_connecting[] ;
|
||||
extern const char report_reverse[] ;
|
||||
extern const char report_accepted[] ;
|
||||
extern const char report_cookie[] ;
|
||||
extern const char report_connected[] ;
|
||||
extern const char report_window[] ;
|
||||
extern const char report_autotune[] ;
|
||||
extern const char report_omit_done[] ;
|
||||
extern const char report_diskfile[] ;
|
||||
extern const char report_done[] ;
|
||||
extern const char report_read_lengths[] ;
|
||||
extern const char report_read_length_times[] ;
|
||||
extern const char report_bw_header[] ;
|
||||
@ -38,6 +49,7 @@ extern const char report_bw_udp_header[] ;
|
||||
extern const char report_bw_format[] ;
|
||||
extern const char report_bw_retrans_format[] ;
|
||||
extern const char report_bw_udp_format[] ;
|
||||
extern const char report_summary[] ;
|
||||
extern const char report_sum_bw_format[] ;
|
||||
extern const char report_sum_bw_retrans_format[] ;
|
||||
extern const char report_sum_bw_udp_format[] ;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user