Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 0 additions & 100 deletions src/common/mfu_flist_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2324,106 +2324,6 @@ static void mfu_sync_all(const char* msg)
}
}

static void print_summary(mfu_flist flist)
{
uint64_t total_dirs = 0;
uint64_t total_files = 0;
uint64_t total_links = 0;
uint64_t total_unknown = 0;
uint64_t total_bytes = 0;

/* get our rank and the size of comm_world */
int rank, ranks;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &ranks);

/* step through and print data */
uint64_t idx = 0;
uint64_t max = mfu_flist_size(flist);
while (idx < max) {
if (mfu_flist_have_detail(flist)) {
/* get mode */
mode_t mode = (mode_t) mfu_flist_file_get_mode(flist, idx);

/* get size */
uint64_t size = mfu_flist_file_get_size(flist, idx);

/* set file type */
if (S_ISDIR(mode)) {
total_dirs++;
}
else if (S_ISREG(mode)) {
total_files++;
total_bytes += size;
}
else if (S_ISLNK(mode)) {
total_links++;
}
else {
/* unknown file type */
total_unknown++;
}
}
else {
/* get type */
mfu_filetype type = mfu_flist_file_get_type(flist, idx);

if (type == MFU_TYPE_DIR) {
total_dirs++;
}
else if (type == MFU_TYPE_FILE) {
total_files++;
}
else if (type == MFU_TYPE_LINK) {
total_links++;
}
else {
/* unknown file type */
total_unknown++;
}
}

/* go to next file */
idx++;
}

/* get total directories, files, links, and bytes */
uint64_t all_dirs, all_files, all_links, all_unknown, all_bytes;
uint64_t all_count = mfu_flist_global_size(flist);
MPI_Allreduce(&total_dirs, &all_dirs, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(&total_files, &all_files, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(&total_links, &all_links, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(&total_unknown, &all_unknown, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(&total_bytes, &all_bytes, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);

/* convert total size to units */
if (mfu_debug_level >= MFU_LOG_VERBOSE && rank == 0) {
MFU_LOG(MFU_LOG_INFO, "Items: %llu", (unsigned long long) all_count);
MFU_LOG(MFU_LOG_INFO, " Directories: %llu", (unsigned long long) all_dirs);
MFU_LOG(MFU_LOG_INFO, " Files: %llu", (unsigned long long) all_files);
MFU_LOG(MFU_LOG_INFO, " Links: %llu", (unsigned long long) all_links);
/* MFU_LOG(" Unknown: %lu", (unsigned long long) all_unknown); */

if (mfu_flist_have_detail(flist)) {
double agg_size_tmp;
const char* agg_size_units;
mfu_format_bytes(all_bytes, &agg_size_tmp, &agg_size_units);

uint64_t size_per_file = 0.0;
if (all_files > 0) {
size_per_file = (uint64_t)((double)all_bytes / (double)all_files);
}
double size_per_file_tmp;
const char* size_per_file_units;
mfu_format_bytes(size_per_file, &size_per_file_tmp, &size_per_file_units);

MFU_LOG(MFU_LOG_INFO, "Data: %.3lf %s (%.3lf %s per file)", agg_size_tmp, agg_size_units, size_per_file_tmp, size_per_file_units);
}
}

return;
}

int mfu_flist_copy(
mfu_flist src_cp_list, /* list of source items to be copied */
int numpaths, /* number of entries in paths array below */
Expand Down
93 changes: 0 additions & 93 deletions src/dsh/dsh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,99 +1222,6 @@ static int sort_files_stat(const char* sortfields, mfu_flist* pflist)
return 0;
}

static void print_summary(mfu_flist flist)
{
/* get our rank and the size of comm_world */
int rank, ranks;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &ranks);

/* step through and print data */
uint64_t idx = 0;
uint64_t max = mfu_flist_size(flist);
while (idx < max) {
if (mfu_flist_have_detail(flist)) {
/* get mode */
mode_t mode = (mode_t) mfu_flist_file_get_mode(flist, idx);

/* set file type */
if (S_ISDIR(mode)) {
total_dirs++;
}
else if (S_ISREG(mode)) {
total_files++;
}
else if (S_ISLNK(mode)) {
total_links++;
}
else {
/* unknown file type */
total_unknown++;
}

uint64_t size = mfu_flist_file_get_size(flist, idx);
total_bytes += size;
}
else {
/* get type */
mfu_filetype type = mfu_flist_file_get_type(flist, idx);

if (type == MFU_TYPE_DIR) {
total_dirs++;
}
else if (type == MFU_TYPE_FILE) {
total_files++;
}
else if (type == MFU_TYPE_LINK) {
total_links++;
}
else {
/* unknown file type */
total_unknown++;
}
}

/* go to next file */
idx++;
}

/* get total directories, files, links, and bytes */
uint64_t all_dirs, all_files, all_links, all_unknown, all_bytes;
uint64_t all_count = mfu_flist_global_size(flist);
MPI_Allreduce(&total_dirs, &all_dirs, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(&total_files, &all_files, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(&total_links, &all_links, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(&total_unknown, &all_unknown, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);
MPI_Allreduce(&total_bytes, &all_bytes, 1, MPI_UINT64_T, MPI_SUM, MPI_COMM_WORLD);

/* convert total size to units */
if (verbose && rank == 0) {
printf("Items: %llu\n", (unsigned long long) all_count);
printf(" Directories: %llu\n", (unsigned long long) all_dirs);
printf(" Files: %llu\n", (unsigned long long) all_files);
printf(" Links: %llu\n", (unsigned long long) all_links);
/* printf(" Unknown: %lu\n", (unsigned long long) all_unknown); */

if (mfu_flist_have_detail(flist)) {
double agg_size_tmp;
const char* agg_size_units;
mfu_format_bytes(all_bytes, &agg_size_tmp, &agg_size_units);

uint64_t size_per_file = 0.0;
if (all_files > 0) {
size_per_file = (uint64_t)((double)all_bytes / (double)all_files);
}
double size_per_file_tmp;
const char* size_per_file_units;
mfu_format_bytes(size_per_file, &size_per_file_tmp, &size_per_file_units);

printf("Data: %.3lf %s (%.3lf %s per file)\n", agg_size_tmp, agg_size_units, size_per_file_tmp, size_per_file_units);
}
}

return;
}

static char mode_format[11];
static void prepare_mode_format(mode_t mode)
{
Expand Down