Commit e6f8e9d4 authored by Philip Carns's avatar Philip Carns

ability to detect mount point by path comparison


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@615 3b7491f3-a168-0410-bf4b-c445ed680a29
parent e79a4e17
...@@ -229,6 +229,7 @@ void darshan_shutdown(int timing_flag); ...@@ -229,6 +229,7 @@ void darshan_shutdown(int timing_flag);
void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs); void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs);
void darshan_walk_file_accesses(struct darshan_job_runtime* final_job); void darshan_walk_file_accesses(struct darshan_job_runtime* final_job);
double darshan_wtime(void); double darshan_wtime(void);
int64_t darshan_mnt_id_from_path(const char* path);
uint32_t darshan_hashlittle(const void *key, size_t length, uint32_t initval); uint32_t darshan_hashlittle(const void *key, size_t length, uint32_t initval);
uint64_t darshan_hash(const register unsigned char *k, register uint64_t length, register uint64_t level); uint64_t darshan_hash(const register unsigned char *k, register uint64_t length, register uint64_t level);
......
...@@ -210,6 +210,7 @@ static struct darshan_file_runtime* darshan_file_by_name_setfh(const char* name, ...@@ -210,6 +210,7 @@ static struct darshan_file_runtime* darshan_file_by_name_setfh(const char* name,
static char* trailing_data = NULL; static char* trailing_data = NULL;
static uint64_t mnt_hash_array[CP_MAX_MNTS] = {0}; static uint64_t mnt_hash_array[CP_MAX_MNTS] = {0};
static int64_t mnt_id_array[CP_MAX_MNTS] = {0}; static int64_t mnt_id_array[CP_MAX_MNTS] = {0};
static char* mnt_path_array[CP_MAX_MNTS] = {0};
static uint64_t mnt_hash_array_root[CP_MAX_MNTS] = {0}; static uint64_t mnt_hash_array_root[CP_MAX_MNTS] = {0};
static int64_t mnt_id_array_root[CP_MAX_MNTS] = {0}; static int64_t mnt_id_array_root[CP_MAX_MNTS] = {0};
struct struct
...@@ -655,6 +656,11 @@ void darshan_shutdown(int timing_flag) ...@@ -655,6 +656,11 @@ void darshan_shutdown(int timing_flag)
if(trailing_data) if(trailing_data)
free(trailing_data); free(trailing_data);
for(i=0; i<CP_MAX_MNTS; i++)
{
if(mnt_path_array[i])
free(mnt_path_array[i]);
}
free(logfile_name); free(logfile_name);
darshan_finalize(final_job); darshan_finalize(final_job);
...@@ -2100,6 +2106,7 @@ static char* darshan_get_exe_and_mounts(struct darshan_job_runtime* final_job) ...@@ -2100,6 +2106,7 @@ static char* darshan_get_exe_and_mounts(struct darshan_job_runtime* final_job)
mnt_hash_array[mnt_array_index] = mnt_hash_array[mnt_array_index] =
darshan_hash((void*)entry->mnt_dir, strlen(entry->mnt_dir), 0); darshan_hash((void*)entry->mnt_dir, strlen(entry->mnt_dir), 0);
mnt_id_array[mnt_array_index] = tmp_st_dev; mnt_id_array[mnt_array_index] = tmp_st_dev;
mnt_path_array[mnt_array_index] = strdup(entry->mnt_dir);
mnt_array_index++; mnt_array_index++;
} }
...@@ -2373,6 +2380,24 @@ static struct darshan_file_runtime* darshan_file_by_fh(MPI_File fh) ...@@ -2373,6 +2380,24 @@ static struct darshan_file_runtime* darshan_file_by_fh(MPI_File fh)
return(tmp_file); return(tmp_file);
} }
/* find the device id for the specified file, based on data from the mount
* entries.
*/
int64_t darshan_mnt_id_from_path(const char* path)
{
int i;
for(i=0; (i<CP_MAX_MNTS && mnt_hash_array[i] != 0); i++)
{
if(!(strncmp(mnt_path_array[i], path, strlen(mnt_path_array[i]))))
{
return(mnt_id_array[i]);
}
}
return(0);
}
/* /*
* Local variables: * Local variables:
* c-indent-level: 4 * c-indent-level: 4
......
...@@ -1639,6 +1639,7 @@ struct darshan_file_runtime* darshan_file_by_name(const char* name) ...@@ -1639,6 +1639,7 @@ struct darshan_file_runtime* darshan_file_by_name(const char* name)
char* suffix_pointer; char* suffix_pointer;
int hash_index; int hash_index;
char* newname = NULL; char* newname = NULL;
int64_t device_id;
if(!darshan_global_job) if(!darshan_global_job)
return(NULL); return(NULL);
...@@ -1684,6 +1685,8 @@ struct darshan_file_runtime* darshan_file_by_name(const char* name) ...@@ -1684,6 +1685,8 @@ struct darshan_file_runtime* darshan_file_by_name(const char* name)
/* new, unique file */ /* new, unique file */
tmp_file = &darshan_global_job->file_runtime_array[darshan_global_job->file_count]; tmp_file = &darshan_global_job->file_runtime_array[darshan_global_job->file_count];
device_id = darshan_mnt_id_from_path(newname);
CP_SET(tmp_file, CP_DEVICE, device_id);
CP_SET(tmp_file, CP_MEM_ALIGNMENT, darshan_mem_alignment); CP_SET(tmp_file, CP_MEM_ALIGNMENT, darshan_mem_alignment);
tmp_file->log_file->hash = tmp_hash; tmp_file->log_file->hash = tmp_hash;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment