22 template<
class>
class QM,
27 inline unsigned long __fastcall
29 const double ws=
double(
this->queue().size());
31 const pool_size_type num_threads=
this->pool_size();
32 const double log_ps=
std::log(
static_cast<
double>(num_threads));
33 const double ideal_min_time=ws/num_threads+log_ps;
36 return static_cast<
unsigned long>(
std::ceil(ideal_min_time));
38 return static_cast<
unsigned long>(
std::ceil(ideal_min_time*log_ps));
46 template<
class>
class QM,
52 inline unsigned long __fastcall
54 const double ws=
double(
this->queue().size());
56 const pool_size_type num_threads=
this->pool_size();
57 const double log_ps=
std::log(
static_cast<
double>(num_threads));
58 const double ideal_min_time=ws/num_threads+log_ps;
61 return static_cast<
unsigned long>(
std::ceil(ideal_min_time));
63 return static_cast<
unsigned long>(
std::ceil(ideal_min_time*log_ps));
71 template<
class>
class QM,
76 inline unsigned long __fastcall
78 const double ws=
double(
this->queue().size());
80 const double ideal_num_processors=
std::ceil(ws/
std::log(ws));
83 return static_cast<
unsigned long>(ideal_num_processors);
85 return static_cast<
unsigned long>(ideal_num_processors*
std::log(
static_cast<
double>(
this->pool_size())));
93 template<
class>
class QM,
99 inline unsigned long __fastcall
101 const double ws=
double(
this->queue().size());
103 const double ideal_num_processors=
std::ceil(ws/
std::log(ws));
106 return static_cast<
unsigned long>(ideal_num_processors);
108 return static_cast<
unsigned long>(ideal_num_processors*
std::log(
static_cast<
double>(
this->pool_size())));
116 template<
class>
class QM,
124 const pool_size_type ps=
this->pool_size();
125 const double log2_ps=
std::log(
double(ps))/
std::log(2);
126 const pool_size_type ceil_log2_ps=
static_cast<pool_size_type>(
std::ceil(log2_ps));
127 const pool_size_type logical_pool_size=(ceil_log2_ps==log2_ps ? ps : 1<<ceil_log2_ps);
129 static_cast<queue_size_type>(1),
132 static_cast<pool_size_type>(1)
143 inline unsigned long __fastcall
145 const double ws=
double(
this->queue().size());
147 const pool_size_type num_threads=
this->pool_size();
148 const double log_ps=
std::log(
static_cast<
double>(num_threads));
149 const double ideal_min_time=ws/num_threads+log_ps;
152 return static_cast<
unsigned long>(
std::ceil(ideal_min_time));
154 return static_cast<
unsigned long>(
std::ceil(ideal_min_time*log_ps));
168 inline unsigned long __fastcall
170 const double ws=
double(
this->queue().size());
172 const pool_size_type num_threads=
this->pool_size();
173 const double log_ps=
std::log(
static_cast<
double>(num_threads));
174 const double ideal_min_time=ws/num_threads+log_ps;
177 return static_cast<
unsigned long>(
std::ceil(ideal_min_time));
179 return static_cast<
unsigned long>(
std::ceil(ideal_min_time*log_ps));
192 inline unsigned long __fastcall
194 const double ws=
double(
this->queue().size());
196 const double ideal_num_processors=
std::ceil(ws/
std::log(ws));
199 return static_cast<
unsigned long>(ideal_num_processors);
201 return static_cast<
unsigned long>(ideal_num_processors*
std::log(
static_cast<
double>(
this->pool_size())));
215 inline unsigned long __fastcall
217 const double ws=
double(
this->queue().size());
219 const double ideal_num_processors=
std::ceil(ws/
std::log(ws));
222 return static_cast<
unsigned long>(ideal_num_processors);
224 return static_cast<
unsigned long>(ideal_num_processors*
std::log(
static_cast<
double>(
this->pool_size())));
240 const pool_size_type ps=
this->pool_size();
241 const double log2_ps=
std::log(
double(ps))/
std::log(2);
242 const pool_size_type ceil_log2_ps=
static_cast<pool_size_type>(
std::ceil(log2_ps));
243 const pool_size_type logical_pool_size=(ceil_log2_ps==log2_ps ? ps : 1<<ceil_log2_ps);
245 static_cast<queue_size_type>(1),
248 static_cast<pool_size_type>(1)
260 operator<<(
tostream &os, thread_pool_queue_model<DM1, Ps1, PTT1, Pt1>
const &t) {
262 <<
static_cast<
typename thread_pool_queue_model<DM1, Ps1, PTT1, Pt1>::base1_t
const &>(t)
263 <<
_T(
", queue details: ")<<
static_cast<
typename thread_pool_queue_model<DM1, Ps1, PTT1, Pt1>::base_t
const &>(t)
264 <<
_T(
", pool details: ")<<t.pool;