Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
07bf9e37
Commit
07bf9e37
authored
May 11, 2021
by
Adam Wujek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrpc-dump: add dump of task list
Signed-off-by:
Adam Wujek
<
adam.wujek@creotech.pl
>
parent
784af03f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
105 additions
and
1 deletion
+105
-1
dump-info.c
dump-info.c
+17
-0
dump-info.h
include/dump-info.h
+9
-0
wrc-task.h
include/wrc-task.h
+2
-0
wrc_global.h
include/wrc_global.h
+2
-0
wrc-tasks.c
lib/wrc-tasks.c
+1
-1
wrpc-dump.c
tools/wrpc-dump.c
+72
-0
wrc_main.c
wrc_main.c
+2
-0
No files found.
dump-info.c
View file @
07bf9e37
...
...
@@ -15,6 +15,8 @@ struct dump_info dump_wrpc_info[] = {
DUMP_FIELD
(
uint32_t
,
version
),
DUMP_FIELD_SIZE
(
char
,
wrc_hw_name
,
HW_NAME_LENGTH
),
DUMP_FIELD
(
pointer
,
link_status
),
DUMP_FIELD
(
int
,
task_list_max
),
DUMP_FIELD
(
pointer
,
task_list
),
#undef DUMP_STRUCT
#define DUMP_STRUCT struct wrc_global_link
...
...
@@ -23,6 +25,21 @@ struct dump_info dump_wrpc_info[] = {
DUMP_FIELD
(
link_up_status
,
link_up
),
DUMP_FIELD
(
int
,
vlan
),
#undef DUMP_STRUCT
#define DUMP_STRUCT struct wrc_task
/* Save the size of the structure, there is no other way to pass
* the size of wrc_task structure */
DUMP_HEADER_SIZE
(
"wrc_task"
,
sizeof
(
struct
wrc_task
)),
DUMP_FIELD
(
int
,
used
),
DUMP_FIELD_SIZE
(
char
,
name
,
16
),
DUMP_FIELD
(
pointer
,
enabled
),
/* pointer to a function */
DUMP_FIELD
(
pointer
,
init
),
/* pointer to a function */
DUMP_FIELD
(
pointer
,
job
),
/* pointer to a function */
DUMP_FIELD
(
unsigned_long
,
nrun
),
DUMP_FIELD
(
unsigned_long
,
seconds
),
DUMP_FIELD
(
unsigned_long
,
nanos
),
DUMP_FIELD
(
unsigned_long
,
max_run_ticks
),
/* in ticks */
#undef DUMP_STRUCT
#define DUMP_STRUCT struct softpll_state
...
...
include/dump-info.h
View file @
07bf9e37
...
...
@@ -69,6 +69,14 @@ extern struct dump_info dump_ppsi_info_target[]; /* wrpc-sw/ppsi/tools/dump_mem_
.name = _struct, \
}
/* Keep the value with the structure name. Intendeed to keep the size of
* structure, but can be used to keep any value. */
#define DUMP_HEADER_SIZE(_struct, _size) { \
.endian_flag = DUMP_ENDIAN_FLAG, \
.name = _struct, \
.size = _size, \
}
/* The macros below rely on DUMP_STRUCT that must be externally defined */
#define DUMP_FIELD(_type, _fname) { \
.endian_flag = 0, \
...
...
@@ -89,6 +97,7 @@ extern struct dump_info dump_ppsi_info_target[]; /* wrpc-sw/ppsi/tools/dump_mem_
void
dump_many_fields
(
void
*
addr
,
char
*
name
,
char
*
prefix
);
unsigned
long
wrpc_get_pointer
(
void
*
base
,
char
*
s_name
,
char
*
f_name
);
unsigned
long
wrpc_get_offset
(
char
*
s_name
,
char
*
f_name
);
unsigned
long
wrpc_get_struct_size
(
char
*
s_name
);
long
long
wrpc_get_64
(
void
*
p
);
long
wrpc_get_l32
(
void
*
p
);
int
wrpc_get_i32
(
void
*
p
);
...
...
include/wrc-task.h
View file @
07bf9e37
...
...
@@ -27,6 +27,8 @@ struct wrc_task {
unsigned
long
max_run_ticks
;
/* in ticks */
};
extern
struct
wrc_task
tasks
[
WRC_MAX_TASKS
];
void
wrc_tasks_preinit
(
void
);
struct
wrc_task
*
wrc_task_create
(
const
char
*
name
,
void
(
*
init
)(
void
),
int
(
*
job
)(
void
)
);
void
wrc_task_set_enable
(
struct
wrc_task
*
task
,
int
(
*
enabled
)(
void
)
);
...
...
include/wrc_global.h
View file @
07bf9e37
...
...
@@ -17,6 +17,8 @@ struct wrc_global {
uint32_t
version
;
char
wrc_hw_name
[
HW_NAME_LENGTH
];
struct
wrc_global_link
*
link_status
;
int
task_list_max
;
struct
wrc_task
*
task_list
;
};
...
...
lib/wrc-tasks.c
View file @
07bf9e37
...
...
@@ -14,7 +14,7 @@ static uint32_t prev_nanos_for_profile;
static
uint32_t
prev_ticks_for_profile
;
uint32_t
print_task_time_threshold
=
CONFIG_DEFAULT_PRINT_TASK_TIME_THRESHOLD
;
st
atic
st
ruct
wrc_task
tasks
[
WRC_MAX_TASKS
];
struct
wrc_task
tasks
[
WRC_MAX_TASKS
];
static
void
task_time_normalize
(
struct
wrc_task
*
t
)
{
...
...
tools/wrpc-dump.c
View file @
07bf9e37
...
...
@@ -337,6 +337,21 @@ unsigned long wrpc_get_offset(char *s_name, char *f_name)
return
0
;
}
unsigned
long
wrpc_get_struct_size
(
char
*
s_name
)
{
struct
dump_info
*
p
;
p
=
find_s_name
(
s_name
);
if
(
!
p
)
{
fprintf
(
stderr
,
"structure
\"
%s
\"
not described
\n
"
,
s_name
);
return
0
;
}
return
wrpc_get_i32
(
&
p
->
size
);
}
void
print_version
(
void
)
{
fprintf
(
stderr
,
"Built in wrpc-sw repo ver:%s, by %s on %s %s
\n
"
,
...
...
@@ -347,6 +362,60 @@ void print_version(void)
WRS_PPSI_SHMEM_VERSION
);
}
void
dump_mem_wrpc_task_list
(
void
*
mapaddr
,
unsigned
long
wrc_global_off
)
{
int
task_i
;
int
max_task
;
char
*
prefix
;
char
pname
[
128
];
long
unsigned
name_off
,
iterations_off
,
sec_off
,
nsec_off
,
max_run_ticks_off
,
used_off
;
void
*
task_addr
;
long
unsigned
task_struct_size
;
unsigned
long
task_list_off
;
task_list_off
=
wrpc_get_pointer
(
mapaddr
+
wrc_global_off
,
"wrc_global"
,
"task_list"
);
if
(
!
task_list_off
)
{
return
;
}
prefix
=
"wrc_global.task_list"
;
printf
(
"%s at 0x%lx
\n
"
,
prefix
,
task_list_off
);
max_task
=
wrpc_get_i32
(
mapaddr
+
wrc_global_off
+
wrpc_get_offset
(
"wrc_global"
,
"task_list_max"
));
/* limit task_i in case max_task is not correct */
if
(
max_task
<
0
)
max_task
=
0
;
if
(
max_task
>
64
)
max_task
=
64
;
used_off
=
wrpc_get_offset
(
"wrc_task"
,
"used"
);
name_off
=
wrpc_get_offset
(
"wrc_task"
,
"name"
);
iterations_off
=
wrpc_get_offset
(
"wrc_task"
,
"nrun"
);
sec_off
=
wrpc_get_offset
(
"wrc_task"
,
"seconds"
);
nsec_off
=
wrpc_get_offset
(
"wrc_task"
,
"nanos"
);
max_run_ticks_off
=
wrpc_get_offset
(
"wrc_task"
,
"max_run_ticks"
);
task_struct_size
=
wrpc_get_struct_size
(
"wrc_task"
);
for
(
task_i
=
0
;
task_i
<
max_task
&&
task_i
<
32
;
task_i
++
)
{
task_addr
=
mapaddr
+
task_list_off
+
task_i
*
task_struct_size
;
if
(
!
wrpc_get_l32
(
task_addr
+
used_off
))
{
/* skip not used tasks */
continue
;
}
sprintf
(
pname
,
"%s[%02d]:"
,
prefix
,
task_i
);
printf
(
"%-60s "
,
pname
);
printf
(
"name: %16s "
,
(
char
*
)(
task_addr
+
name_off
));
printf
(
"iterations: %10ld "
,
wrpc_get_l32
(
task_addr
+
iterations_off
));
printf
(
"secs: %10ld.%06ld "
,
wrpc_get_l32
(
task_addr
+
sec_off
),
(
wrpc_get_l32
(
task_addr
+
nsec_off
))
/
1000
);
printf
(
"max_ms: %8ld
\n
"
,
wrpc_get_l32
(
task_addr
+
max_run_ticks_off
));
}
}
void
dump_mem_wrpc_global
(
void
*
mapaddr
,
unsigned
long
wrc_global_off
)
{
unsigned
long
tmp_off
;
...
...
@@ -363,6 +432,9 @@ void dump_mem_wrpc_global(void *mapaddr, unsigned long wrc_global_off)
dump_many_fields
(
mapaddr
+
tmp_off
,
"wrc_global_link"
,
prefix
);
}
/* dump task list */
dump_mem_wrpc_task_list
(
mapaddr
,
wrc_global_off
);
}
/* all of these are 0 by default */
...
...
wrc_main.c
View file @
07bf9e37
...
...
@@ -73,6 +73,8 @@ struct wrc_global wrc_global = {
.
magic
=
WRC_G_MAGIC
,
.
version
=
WRC_G_VERSION
,
.
link_status
=
&
wrc_global_link
,
.
task_list_max
=
WRC_MAX_TASKS
,
.
task_list
=
tasks
,
};
int
*
link_status
=
&
wrc_global_link
.
link_up
;
...
...
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