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
Elsa Gonsiorowski
codes
Commits
dc5519e2
Commit
dc5519e2
authored
Feb 20, 2014
by
Jonathan Jenkins
Browse files
utility to print all codes-workload operations
parent
b53fe566
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Makefile.subdir
View file @
dc5519e2
...
...
@@ -100,11 +100,18 @@ src_libcodes_base_a_SOURCES = \
# stealth testing of the template code (actual test is not run, just compiled as
# a program - Make error signifies test failure)
check_PROGRAMS
+=
src/util/templates/lp_template_dummy_main
testlib
_template
=
src/libcodes-base.a
src_util_templates_lp_template_dummy_main_LDADD
=
$(testlib
_template
)
${ROSS_LIBS}
testlib
=
src/libcodes-base.a
src_util_templates_lp_template_dummy_main_LDADD
=
$(testlib)
${ROSS_LIBS}
src_util_templates_lp_template_dummy_main_LDFLAGS
=
${ROSS_LDFLAGS}
src_util_templates_lp_template_dummy_main_SOURCES
=
\
src/util/templates/lp_template_dummy_main.c
\
src/util/templates/lp_template.c
\
src/util/templates/lp_template.h
# get rid of annoying unused function in template
bin_PROGRAMS
+=
src/workload/codes-workload-dump
src_workload_codes_workload_dump_SOURCES
=
\
src/workload/codes-workload-dump.c
src_workload_codes_workload_dump_LDADD
=
$(testlib)
${DARSHAN_LIBS}
${ROSS_LIBS}
src_workload_codes_workload_dump_LDFLAGS
=
${DARSHAN_LDFLAGS}
${ROSS_LDFLAGS}
src/workload/codes-workload-dump.c
0 → 100644
View file @
dc5519e2
/*
* Copyright (C) 2014 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#include <assert.h>
#include <getopt.h>
#include <stdio.h>
#include "codes/codes-workload.h"
static
char
type
[
128
]
=
{
'\0'
};
static
darshan_params
d_params
=
{
NULL
,
""
,
0
};
static
int
n
=
-
1
;
static
struct
option
long_opts
[]
=
{
{
"type"
,
required_argument
,
NULL
,
't'
},
{
"num-ranks"
,
required_argument
,
NULL
,
'n'
},
{
"d-log"
,
optional_argument
,
NULL
,
'l'
},
{
"d-aggregator-cnt"
,
optional_argument
,
NULL
,
'a'
},
{
NULL
,
0
,
NULL
,
0
}
};
int
main
(
int
argc
,
char
*
argv
[])
{
char
ch
;
while
((
ch
=
getopt_long
(
argc
,
argv
,
"t:l:a:"
,
long_opts
,
NULL
))
!=
-
1
){
switch
(
ch
){
case
't'
:
strcpy
(
type
,
optarg
);
break
;
case
'n'
:
n
=
atoi
(
optarg
);
assert
(
n
>
0
);
break
;
case
'l'
:
strcpy
(
d_params
.
log_file_path
,
optarg
);
break
;
case
'a'
:
d_params
.
aggregator_cnt
=
atol
(
optarg
);
break
;
}
}
int
i
;
char
*
wparams
;
if
(
strcmp
(
type
,
"darshan_io_workload"
)
==
0
){
wparams
=
(
char
*
)
&
d_params
;
}
else
{
wparams
=
NULL
;
}
for
(
i
=
0
;
i
<
n
;
i
++
){
struct
codes_workload_op
op
;
printf
(
"loading %s, %d
\n
"
,
type
,
i
);
int
id
=
codes_workload_load
(
type
,
wparams
,
i
);
assert
(
id
!=
-
1
);
do
{
codes_workload_get_next
(
id
,
i
,
&
op
);
codes_workload_print_op
(
stdout
,
&
op
,
i
);
}
while
(
op
.
op_type
!=
CODES_WK_END
);
}
return
0
;
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ft=c ts=8 sts=4 sw=4 expandtab
*/
src/workload/codes-workload.c
View file @
dc5519e2
...
...
@@ -169,33 +169,33 @@ void* codes_workload_get_info(int wkld_id, int rank)
void
codes_workload_print_op
(
FILE
*
f
,
struct
codes_workload_op
*
op
,
int
rank
){
switch
(
op
->
op_type
){
case
CODES_WK_END
:
fprintf
(
f
,
"op: rank:%d
,
type:end
\n
"
,
rank
);
fprintf
(
f
,
"op: rank:%d type:end
\n
"
,
rank
);
break
;
case
CODES_WK_DELAY
:
fprintf
(
f
,
"op: rank:%d
,
type:delay
,
seconds:%lf
\n
"
,
fprintf
(
f
,
"op: rank:%d type:delay seconds:%lf
\n
"
,
rank
,
op
->
u
.
delay
.
seconds
);
break
;
case
CODES_WK_BARRIER
:
fprintf
(
f
,
"op: rank:%d
,
type:barrier
,
count:%d
,
root:%d
\n
"
,
fprintf
(
f
,
"op: rank:%d type:barrier count:%d root:%d
\n
"
,
rank
,
op
->
u
.
barrier
.
count
,
op
->
u
.
barrier
.
root
);
break
;
case
CODES_WK_OPEN
:
fprintf
(
f
,
"op: rank:%d
,
type:open
,
file_id:%lu
,
flag:%d
\n
"
,
fprintf
(
f
,
"op: rank:%d type:open file_id:%lu flag:%d
\n
"
,
rank
,
op
->
u
.
open
.
file_id
,
op
->
u
.
open
.
create_flag
);
break
;
case
CODES_WK_CLOSE
:
fprintf
(
f
,
"op: rank:%d
,
type:close
,
file_id:%lu
\n
"
,
fprintf
(
f
,
"op: rank:%d type:close file_id:%lu
\n
"
,
rank
,
op
->
u
.
close
.
file_id
);
break
;
case
CODES_WK_WRITE
:
fprintf
(
f
,
"op: rank:%d
,
type:write
,
"
"file_id:%lu
,
off:%lu
,
size:%lu
\n
"
,
fprintf
(
f
,
"op: rank:%d type:write "
"file_id:%lu off:%lu size:%lu
\n
"
,
rank
,
op
->
u
.
write
.
file_id
,
op
->
u
.
write
.
offset
,
op
->
u
.
write
.
size
);
break
;
case
CODES_WK_READ
:
fprintf
(
f
,
"op: rank:%d
,
type:read
,
"
"file_id:%lu
,
off:%lu
,
size:%lu
\n
"
,
fprintf
(
f
,
"op: rank:%d type:read "
"file_id:%lu off:%lu size:%lu
\n
"
,
rank
,
op
->
u
.
read
.
file_id
,
op
->
u
.
read
.
offset
,
op
->
u
.
read
.
size
);
break
;
...
...
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