| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| library fuchsia.device.schedule.work.test; |
| |
| using zx; |
| |
| /// Buckets are arranged as following: |
| /// [0] => [0ns, 100ns] |
| /// [1] => [100ns, 250ns] |
| /// [2] => [250ns, 500ns] |
| /// [3] => [500ns, 1us] |
| /// [4] => [1us, 2us] |
| /// [5] => [2us, 4us] |
| /// [6] => [4us, 7us] |
| /// [7] => [7us, 15us] |
| /// [8] => [15us, 30us] |
| /// [9] => [30us, infinity] |
| struct LatencyHistogram { |
| array<uint64>:10 buckets; |
| }; |
| |
| protocol TestDevice { |
| /// Schedules work. |batch_size| refers to how many work_items to keep |
| /// outstanding at any given time, while |num_work_items| refers to total |
| /// number of work items. |
| ScheduleWork(uint32 batch_size, uint32 num_work_items) -> () error zx.status; |
| |
| /// Spawns a thread which schedules work. |
| ScheduleWorkDifferentThread() -> () error zx.status; |
| |
| /// Triggers once all outstanding work is complete. |
| GetDoneEvent() -> (handle<event> event) error zx.status; |
| |
| /// Returns whether how many work items ran since last time it was invoked. |
| ScheduledWorkRan() -> (uint32 work_items_run, LatencyHistogram histogram); |
| |
| /// Spawns an thread with a dedicated async loop. |
| GetChannel(request<OwnedChannelDevice> test) -> () error zx.status; |
| }; |
| |
| // This is only necessary because it is currently not possible to |
| // asynchronously reply to a fidl message. |
| protocol OwnedChannelDevice { |
| /// Schedules work and blocks until it completes. |batch_size| refers to how |
| /// many work_items to keep outstanding at any given time, while |
| /// |num_work_items| refers to total number of work items. |
| ScheduleWork(uint32 batch_size, uint32 num_work_items) |
| -> (LatencyHistogram histogram) error zx.status; |
| }; |