mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2026-08-27 00:26:02 -04:00
gdb, amd-dbgapi-target: split wave_coordinates::to_string
wave_coordinates::to_string() produces a string in the following format: AMDGPU Wave a:q:d:w (x,y,z)/i Split the method into smaller pieces: a:q:d:w : hierarchy_str (x,y,z) : workgroup_coord_str (x,y,z)/i : dispatch_pos_str This is a refactoring to allow reusing pieces and also to let the code document itself better. Currently the reuse opportunity exists in the downstream debugger. Approved-By: Simon Marchi <simon.marchi@efficios.com> Approved-by: Lancelot Six <lancelot.six@amd.com> (amdgpu)
This commit is contained in:
parent
443989d2b0
commit
57f5450b76
1 changed files with 45 additions and 11 deletions
|
|
@ -147,6 +147,17 @@ struct wave_coordinates
|
|||
: wave_id (wave_id)
|
||||
{}
|
||||
|
||||
/* Return the string showing the agent -> queue -> dispatch -> wave
|
||||
hierarchy. */
|
||||
std::string hierarchy_str () const;
|
||||
|
||||
/* Return the workgroup coordinates as a string. */
|
||||
std::string workgroup_coord_str () const;
|
||||
|
||||
/* Return the dispatch position string for the wave this
|
||||
wave_coordinates is for. */
|
||||
std::string dispatch_pos_str () const;
|
||||
|
||||
/* Return the target ID string for the wave this wave_coordinates is
|
||||
for. */
|
||||
std::string to_string () const;
|
||||
|
|
@ -387,13 +398,12 @@ get_amd_dbgapi_inferior_info (inferior *inferior)
|
|||
static async_event_handler *amd_dbgapi_async_event_handler = nullptr;
|
||||
|
||||
std::string
|
||||
wave_coordinates::to_string () const
|
||||
wave_coordinates::hierarchy_str () const
|
||||
{
|
||||
std::string str = "AMDGPU Wave";
|
||||
|
||||
str += (agent_id != AMD_DBGAPI_AGENT_NONE
|
||||
? string_printf (" %s", pulongest (agent_id.handle))
|
||||
: " ?");
|
||||
std::string str
|
||||
= (agent_id != AMD_DBGAPI_AGENT_NONE
|
||||
? string_printf (" %s", pulongest (agent_id.handle))
|
||||
: "?");
|
||||
|
||||
str += (queue_id != AMD_DBGAPI_QUEUE_NONE
|
||||
? string_printf (":%s", pulongest (queue_id.handle))
|
||||
|
|
@ -405,12 +415,25 @@ wave_coordinates::to_string () const
|
|||
|
||||
str += string_printf (":%s", pulongest (wave_id.handle));
|
||||
|
||||
str += (group_ids[0] != UINT32_MAX
|
||||
? string_printf (" (%s,%s,%s)", pulongest (group_ids[0]),
|
||||
pulongest (group_ids[1]),
|
||||
pulongest (group_ids[2]))
|
||||
: " (?,?,?)");
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string
|
||||
wave_coordinates::workgroup_coord_str () const
|
||||
{
|
||||
std::string str
|
||||
= (group_ids[0] != UINT32_MAX
|
||||
? string_printf (" (%s,%s,%s)", pulongest (group_ids[0]),
|
||||
pulongest (group_ids[1]), pulongest (group_ids[2]))
|
||||
: "(?,?,?)");
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string
|
||||
wave_coordinates::dispatch_pos_str () const
|
||||
{
|
||||
std::string str = workgroup_coord_str ();
|
||||
str += (wave_in_group != UINT32_MAX
|
||||
? string_printf ("/%s", pulongest (wave_in_group))
|
||||
: "/?");
|
||||
|
|
@ -418,6 +441,17 @@ wave_coordinates::to_string () const
|
|||
return str;
|
||||
}
|
||||
|
||||
std::string
|
||||
wave_coordinates::to_string () const
|
||||
{
|
||||
std::string str = "AMDGPU Wave";
|
||||
|
||||
str += " " + hierarchy_str ();
|
||||
str += " " + dispatch_pos_str ();
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/* Read in wave_info for WAVE_ID. */
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue