Path: blob/21.2-virgl/src/gallium/frontends/clover/core/timestamp.hpp
4572 views
//1// Copyright 2013 Francisco Jerez2//3// Permission is hereby granted, free of charge, to any person obtaining a4// copy of this software and associated documentation files (the "Software"),5// to deal in the Software without restriction, including without limitation6// the rights to use, copy, modify, merge, publish, distribute, sublicense,7// and/or sell copies of the Software, and to permit persons to whom the8// Software is furnished to do so, subject to the following conditions:9//10// The above copyright notice and this permission notice shall be included in11// all copies or substantial portions of the Software.12//13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR17// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19// OTHER DEALINGS IN THE SOFTWARE.20//2122#ifndef CLOVER_CORE_TIMESTAMP_HPP23#define CLOVER_CORE_TIMESTAMP_HPP2425#include "core/object.hpp"2627struct pipe_query;2829namespace clover {30class command_queue;3132namespace timestamp {33///34/// Emit a timestamp query that is executed asynchronously by35/// the command queue \a q.36///37class query {38public:39query(command_queue &q);40query(query &&other);41~query();4243query &operator=(const query &) = delete;4445///46/// Retrieve the query results.47///48cl_ulong operator()() const;4950private:51const intrusive_ref<command_queue> q;52pipe_query *_query;53};5455///56/// Get the current timestamp value.57///58class current {59public:60current(command_queue &q);6162///63/// Retrieve the query results.64///65cl_ulong operator()() const;6667private:68cl_ulong result;69};70}71}7273#endif747576