mirror of
https://github.com/Tha14/toxic.git
synced 2025-12-08 05:46:34 +01:00
Add run time, avg. kb/s and packets/s to netprof log dump
This commit is contained in:
21
src/toxic.c
21
src/toxic.c
@@ -195,7 +195,7 @@ void free_global_data(void)
|
||||
void exit_toxic_success(Tox *m)
|
||||
{
|
||||
if (arg_opts.netprof_log_dump) {
|
||||
netprof_log_dump(m, arg_opts.netprof_fp);
|
||||
netprof_log_dump(m, arg_opts.netprof_fp, get_unix_time() - arg_opts.netprof_start_time);
|
||||
}
|
||||
|
||||
store_data(m, DATA_FILE);
|
||||
@@ -1455,6 +1455,25 @@ static void parse_args(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
|
||||
case 's': {
|
||||
if (optarg == NULL) {
|
||||
queue_init_message("Invalid argument for option: %d", opt);
|
||||
break;
|
||||
}
|
||||
|
||||
arg_opts.netprof_fp = fopen(optarg, "w");
|
||||
|
||||
if (arg_opts.netprof_fp != NULL) {
|
||||
queue_init_message("Network profile logging enabled. Logging to file: '%s'", optarg);
|
||||
arg_opts.netprof_log_dump = true;
|
||||
arg_opts.netprof_start_time = time(NULL);
|
||||
} else {
|
||||
queue_init_message("Failed to open file '%s' for network profile logging.", optarg);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'u': {
|
||||
arg_opts.unencrypt_data = 1;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user