Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
darshan
darshan
Commits
39452379
Commit
39452379
authored
Apr 30, 2020
by
Jakob Luettgau
Committed by
Shane Snyder
Apr 30, 2020
Browse files
Darshan logutil helpers for Python bindings
parent
55921949
Changes
3
Hide whitespace changes
Inline
Side-by-side
darshan-util/darshan-logutils.c
View file @
39452379
...
...
@@ -1837,6 +1837,98 @@ int darshan_log_get_namerecs_3_00(void *name_rec_buf, int buf_len,
return
(
buf_processed
);
}
/*
* Support functions for use with other languages
*/
/*
* darshan_log_get_modules
*
* Gets list of modules present in logs and returns the info
*/
void
darshan_log_get_modules
(
darshan_fd
fd
,
struct
darshan_mod_info
**
mods
,
int
*
count
)
{
int
i
;
int
j
;
*
mods
=
malloc
(
sizeof
(
**
mods
)
*
DARSHAN_MAX_MODS
);
assert
(
*
mods
);
for
(
i
=
0
,
j
=
0
;
i
<
DARSHAN_MAX_MODS
;
i
++
)
{
if
(
fd
->
mod_map
[
i
].
len
)
{
(
*
mods
)[
j
].
name
=
darshan_module_names
[
i
];
(
*
mods
)[
j
].
len
=
fd
->
mod_map
[
i
].
len
;
(
*
mods
)[
j
].
ver
=
fd
->
mod_ver
[
i
];
(
*
mods
)[
j
].
idx
=
i
;
j
+=
1
;
}
}
*
count
=
j
;
}
/*
* darshan_log_get_name_records
*
* Gets list of hashed name_records present in logs and returns the info
*/
void
darshan_log_get_name_records
(
darshan_fd
fd
,
struct
darshan_name_record_info
**
name_records
,
int
*
count
)
{
int
ret
;
struct
darshan_name_record_ref
*
name_hash
=
NULL
;
struct
darshan_name_record_ref
*
ref
=
NULL
;
struct
darshan_name_record_ref
*
tmp
=
NULL
;
struct
darshan_name_record_ref
*
curr
=
NULL
;
/* read hash of darshan records */
ret
=
darshan_log_get_namehash
(
fd
,
&
name_hash
);
if
(
ret
<
0
)
{
darshan_log_close
(
fd
);
return
(
-
1
);
}
int
num
=
HASH_CNT
(
hlink
,
name_hash
);
*
name_records
=
malloc
(
sizeof
(
**
name_records
)
*
num
);
assert
(
*
name_records
);
int
i
=
0
;
HASH_ITER
(
hlink
,
name_hash
,
curr
,
tmp
)
{
(
*
name_records
)[
i
].
id
=
curr
->
name_record
->
id
;
(
*
name_records
)[
i
].
name
=
curr
->
name_record
->
name
;
i
++
;
}
*
count
=
num
;
return
;
}
/*
* darshan_log_get_record
*
* Wrapper to hide the mod_logutils callback functions.
*/
int
darshan_log_get_record
(
darshan_fd
fd
,
int
mod_idx
,
void
**
buf
)
{
int
r
;
r
=
mod_logutils
[
mod_idx
]
->
log_get_record
(
fd
,
buf
);
return
r
;
}
/*
* Local variables:
* c-indent-level: 4
...
...
darshan-util/darshan-logutils.h
View file @
39452379
...
...
@@ -68,6 +68,22 @@ struct darshan_mnt_info
char
mnt_path
[
DARSHAN_EXE_LEN
];
};
struct
darshan_mod_info
{
char
*
name
;
int
len
;
int
ver
;
int
idx
;
};
struct
darshan_name_record_info
{
darshan_record_id
id
;
char
*
name
;
};
/* functions to be implemented by each module for integration with
* darshan log file utilities (e.g., parser & convert tools)
*/
...
...
@@ -158,6 +174,11 @@ int darshan_log_put_mod(darshan_fd fd, darshan_module_id mod_id,
void
*
mod_buf
,
int
mod_buf_sz
,
int
ver
);
void
darshan_log_close
(
darshan_fd
file
);
void
darshan_log_print_version_warnings
(
const
char
*
version_string
);
void
darshan_log_get_modules
(
darshan_fd
fd
,
struct
darshan_mod_info
**
mods
,
int
*
count
);
void
darshan_log_get_name_records
(
darshan_fd
fd
,
struct
darshan_name_record_info
**
mods
,
int
*
count
);
int
darshan_log_get_record
(
darshan_fd
fd
,
int
mod_idx
,
void
**
buf
);
/* convenience macros for printing Darshan counters */
#define DARSHAN_PRINT_HEADER() \
...
...
darshan-util/darshan-stdio-logutils.c
View file @
39452379
...
...
@@ -109,7 +109,7 @@ static int darshan_log_get_stdio_record(darshan_fd fd, void** stdio_buf_p)
*
((
int64_t
*
)
src_p
)
=
-
1
;
}
memcpy
(
file
,
scratch
,
sizeof
(
struct
darshan_
posix
_file
));
memcpy
(
file
,
scratch
,
sizeof
(
struct
darshan_
stdio
_file
));
}
exit:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment