mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 02:58:05 +02:00
rusticl/core: Add profiling time storage (queued) to event
Add the first, of a few, profiling time values to the Event,
with access methods. This is defined as
'when the command identified by event is enqueued in a command-queue
by the host'
Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24101>
This commit is contained in:
parent
a944a8eba9
commit
6052e58bf6
1 changed files with 23 additions and 3 deletions
|
|
@ -25,10 +25,16 @@ static_assert!(CL_QUEUED == 3);
|
|||
|
||||
pub type EventSig = Box<dyn Fn(&Arc<Queue>, &PipeContext) -> CLResult<()>>;
|
||||
|
||||
pub enum EventTimes {
|
||||
Queued = CL_PROFILING_COMMAND_QUEUED as isize,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct EventMutState {
|
||||
status: cl_int,
|
||||
cbs: [Vec<(EventCB, *mut c_void)>; 3],
|
||||
work: Option<EventSig>,
|
||||
time_queued: cl_ulong,
|
||||
}
|
||||
|
||||
pub struct Event {
|
||||
|
|
@ -62,8 +68,8 @@ impl Event {
|
|||
deps: deps,
|
||||
state: Mutex::new(EventMutState {
|
||||
status: CL_QUEUED as cl_int,
|
||||
cbs: [Vec::new(), Vec::new(), Vec::new()],
|
||||
work: Some(work),
|
||||
..Default::default()
|
||||
}),
|
||||
cv: Condvar::new(),
|
||||
})
|
||||
|
|
@ -78,8 +84,7 @@ impl Event {
|
|||
deps: Vec::new(),
|
||||
state: Mutex::new(EventMutState {
|
||||
status: CL_SUBMITTED as cl_int,
|
||||
cbs: [Vec::new(), Vec::new(), Vec::new()],
|
||||
work: None,
|
||||
..Default::default()
|
||||
}),
|
||||
cv: Condvar::new(),
|
||||
})
|
||||
|
|
@ -127,6 +132,21 @@ impl Event {
|
|||
self.cmd_type == CL_COMMAND_USER
|
||||
}
|
||||
|
||||
pub fn set_time(&self, which: EventTimes, value: cl_ulong) {
|
||||
let mut lock = self.state();
|
||||
match which {
|
||||
EventTimes::Queued => lock.time_queued = value,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_time(&self, which: EventTimes) -> cl_ulong {
|
||||
let lock = self.state();
|
||||
|
||||
match which {
|
||||
EventTimes::Queued => lock.time_queued,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_cb(&self, state: cl_int, cb: EventCB, data: *mut c_void) {
|
||||
let mut lock = self.state();
|
||||
let status = lock.status;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue