1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

- only show 1 cleanup msg per client

- show client count in progress
(This used to be commit 10ee1d22e606847d40fb013c694ed5733ef6b87b)
This commit is contained in:
Andrew Tridgell 2002-02-05 03:55:20 +00:00
parent 3608da565f
commit 007a9a5cdc
2 changed files with 17 additions and 7 deletions

View File

@ -39,6 +39,7 @@ static struct {
static struct {
double bytes_in, bytes_out;
int line;
int done;
} *children;
double nbio_total(void)
@ -54,14 +55,15 @@ double nbio_total(void)
void nb_alarm(void)
{
int i;
int lines=0;
int lines=0, num_clients=0;
if (nbio_id != -1) return;
for (i=0;i<nprocs;i++) {
lines += children[i].line;
if (!children[i].done) num_clients++;
}
printf("%8d %.2f MB/sec\r", lines/nprocs, 1.0e-6 * nbio_total() / end_timer());
printf("%4d %8d %.2f MB/sec\r", num_clients, lines/nprocs, 1.0e-6 * nbio_total() / end_timer());
signal(SIGALRM, nb_alarm);
alarm(1);
@ -107,6 +109,7 @@ void nb_setup(struct cli_state *cli)
signal(SIGSEGV, sigsegv);
c = cli;
start_timer();
children[nbio_id].done = 0;
}
@ -262,7 +265,10 @@ static void delete_fn(file_info *finfo, const char *name, void *state)
n[strlen(n)-1] = 0;
asprintf(&s, "%s%s", n, finfo->name);
if (finfo->mode & aDIR) {
nb_deltree(s);
char *s2;
asprintf(&s2, "%s\\*", s);
cli_list(c, s2, aDIR, delete_fn, NULL);
nb_rmdir(s);
} else {
total_deleted++;
nb_unlink(s);
@ -277,10 +283,16 @@ void nb_deltree(char *dname)
asprintf(&mask, "%s\\*", dname);
total_deleted = 0;
cli_list(c, mask, aDIR, delete_fn, NULL);
free(mask);
cli_rmdir(c, dname);
if (total_deleted) printf("WARNING: Cleaned up %d files\n", total_deleted);
}
void nb_cleanup(void)
{
cli_rmdir(c, "clients");
children[nbio_id].done = 1;
}

View File

@ -709,9 +709,7 @@ static BOOL run_netbench(int client)
}
fclose(f);
slprintf(fname,sizeof(fname), "clients/client%d", client);
rmdir(fname);
rmdir("clients");
nb_cleanup();
if (!torture_close_connection(&cli)) {
correct = False;