Line data Source code
1 : #include <algorithm> 2 : #include <cassert> 3 : #include <sstream> 4 : 5 : #include "Runtime/Task/Task.hpp" 6 : 7 : namespace spu 8 : { 9 : namespace runtime 10 : { 11 : 12 : bool 13 4132091 : Task::is_stats() const 14 : { 15 4132091 : return this->stats; 16 : } 17 : 18 : bool 19 4152141 : Task::is_fast() const 20 : { 21 : #ifndef SPU_FAST 22 4152141 : return this->fast; 23 : #else 24 : return true; 25 : #endif 26 : } 27 : 28 : bool 29 4133279 : Task::is_debug() const 30 : { 31 4133279 : return this->debug; 32 : } 33 : 34 : bool 35 : Task::is_debug_hex() const 36 : { 37 : return this->debug_hex; 38 : } 39 : 40 : bool 41 793 : Task::is_last_input_socket(const Socket& s_in) const 42 : { 43 793 : return last_input_socket == &s_in; 44 : } 45 : 46 : bool 47 0 : Task::is_outbuffers_allocated() const 48 : { 49 0 : return this->outbuffers_allocated; 50 : } 51 : 52 : module::Module& 53 17415936 : Task::get_module() const 54 : { 55 17415936 : return *this->module; 56 : } 57 : 58 : std::string 59 0 : Task::get_name() const 60 : { 61 0 : return this->name; 62 : } 63 : 64 : uint32_t 65 3064 : Task::get_n_calls() const 66 : { 67 3064 : return this->n_calls; 68 : } 69 : 70 : Socket& 71 55 : Task::operator[](const size_t id) 72 : { 73 55 : assert((size_t)id < this->sockets.size()); 74 56 : assert(this->sockets[id] != nullptr); 75 : 76 56 : return *this->sockets[id]; 77 : } 78 : 79 : void 80 : Task::update_timer(const size_t id, const std::chrono::nanoseconds& duration) 81 : { 82 : if (this->is_stats()) 83 : { 84 : this->timers_n_calls[id]++; 85 : this->timers_total[id] += duration; 86 : if (this->n_calls) 87 : { 88 : this->timers_max[id] = std::max(this->timers_max[id], duration); 89 : this->timers_min[id] = std::min(this->timers_min[id], duration); 90 : } 91 : else 92 : { 93 : this->timers_max[id] = duration; 94 : this->timers_min[id] = duration; 95 : } 96 : } 97 : } 98 : 99 : const std::vector<int>& 100 4219745 : Task::get_status() const 101 : { 102 4219745 : return this->status; 103 : } 104 : } 105 : }