1
0
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:
jfreegman
2022-01-31 12:45:35 -05:00
parent b91f5a8758
commit 15ab58aa13
4 changed files with 37 additions and 5 deletions

View File

@@ -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;