Home | History | Annotate | Download | only in util

Lines Matching refs:total

23 void Shard(int max_parallelism, thread::ThreadPool* workers, int64 total,
25 CHECK_GE(total, 0);
26 if (total == 0) {
31 work(0, total);
35 workers->ParallelFor(total, cost_per_unit, work);
39 // We shard [0, total) into "num_shards" shards.
42 // If total * cost_per_unit is small, it is not worth shard too
48 total * cost_per_unit / kMinCostPerShard));
50 // Each shard contains up to "block_size" units. [0, total) is sharded
56 const int64 block_size = (total + num_shards - 1) / num_shards;
57 CHECK_GT(block_size, 0); // total > 0 guarantees this.
58 if (block_size >= total) {
59 work(0, total);
62 const int num_shards_used = (total + block_size - 1) / block_size;
64 for (int64 start = block_size; start < total; start += block_size) {
65 auto limit = std::min(start + block_size, total);
73 work(0, std::min(block_size, total));