Lines Matching refs:thread

3291     ThreadState* thread;  member
3298 ThreadState* thread = arg->thread; in ThreadBody() local
3312 thread->stats.Start(thread->tid); in ThreadBody()
3313 (arg->bm->*(arg->method))(thread); in ThreadBody()
3314 thread->stats.Stop(); in ThreadBody()
3371 arg[i].thread = new ThreadState(i); in RunBenchmark()
3372 arg[i].thread->stats.SetReporterAgent(reporter_agent.get()); in RunBenchmark()
3373 arg[i].thread->shared = &shared; in RunBenchmark()
3392 merge_stats.Merge(arg[i].thread->stats); in RunBenchmark()
3397 delete arg[i].thread; in RunBenchmark()
3404 void Crc32c(ThreadState* thread) { in Crc32c() argument
3415 thread->stats.FinishedOps(nullptr, nullptr, 1, kCrc); in Crc32c()
3421 thread->stats.AddBytes(bytes); in Crc32c()
3422 thread->stats.AddMessage(label); in Crc32c()
3425 void xxHash(ThreadState* thread) { in xxHash() argument
3434 thread->stats.FinishedOps(nullptr, nullptr, 1, kHash); in xxHash()
3440 thread->stats.AddBytes(bytes); in xxHash()
3441 thread->stats.AddMessage(label); in xxHash()
3444 void AcquireLoad(ThreadState* thread) { in AcquireLoad() argument
3449 thread->stats.AddMessage("(each op is 1000 loads)"); in AcquireLoad()
3455 thread->stats.FinishedOps(nullptr, nullptr, 1, kOthers); in AcquireLoad()
3460 void Compress(ThreadState *thread) { in Compress() argument
3478 thread->stats.FinishedOps(nullptr, nullptr, 1, kCompress); in Compress()
3482 thread->stats.AddMessage("(compression failure)"); in Compress()
3487 thread->stats.AddMessage(buf); in Compress()
3488 thread->stats.AddBytes(bytes); in Compress()
3492 void Uncompress(ThreadState *thread) { in Uncompress() argument
3561 thread->stats.FinishedOps(nullptr, nullptr, 1, kUncompress); in Uncompress()
3565 thread->stats.AddMessage("(compression failure)"); in Uncompress()
3567 thread->stats.AddBytes(bytes); in Uncompress()
4257 void WriteSeqDeterministic(ThreadState* thread) { in WriteSeqDeterministic() argument
4258 DoDeterministicCompact(thread, open_options_.compaction_style, SEQUENTIAL); in WriteSeqDeterministic()
4261 void WriteUniqueRandomDeterministic(ThreadState* thread) { in WriteUniqueRandomDeterministic() argument
4262 DoDeterministicCompact(thread, open_options_.compaction_style, in WriteUniqueRandomDeterministic()
4266 void WriteSeq(ThreadState* thread) { in WriteSeq() argument
4267 DoWrite(thread, SEQUENTIAL); in WriteSeq()
4270 void WriteRandom(ThreadState* thread) { in WriteRandom() argument
4271 DoWrite(thread, RANDOM); in WriteRandom()
4274 void WriteUniqueRandom(ThreadState* thread) { in WriteUniqueRandom() argument
4275 DoWrite(thread, UNIQUE_RANDOM); in WriteUniqueRandom()
4320 DB* SelectDB(ThreadState* thread) { in SelectDB() argument
4321 return SelectDBWithCfh(thread)->db; in SelectDB()
4324 DBWithColumnFamilies* SelectDBWithCfh(ThreadState* thread) { in SelectDBWithCfh() argument
4325 return SelectDBWithCfh(thread->rand.Next()); in SelectDBWithCfh()
4340 void DoWrite(ThreadState* thread, WriteMode write_mode) { in DoWrite() argument
4359 key_gens[i].reset(new KeyGenerator(&(thread->rand), write_mode, in DoWrite()
4367 thread->stats.AddMessage(msg); in DoWrite()
4404 size_t id = thread->rand.Next() % num_key_gens; in DoWrite()
4481 if (thread->shared->write_rate_limiter.get() != nullptr) { in DoWrite()
4482 thread->shared->write_rate_limiter->Request( in DoWrite()
4488 thread->stats.ResetLastOpTime(); in DoWrite()
4493 thread->stats.FinishedOps(db_with_cfh, db_with_cfh->db, in DoWrite()
4499 if (now > thread->stats.GetSineInterval()) { in DoWrite()
4500 usecs_since_last = now - thread->stats.GetSineInterval(); in DoWrite()
4508 static_cast<double>(now - thread->stats.GetStart()); in DoWrite()
4509 thread->stats.ResetSineInterval(); in DoWrite()
4512 thread->shared->write_rate_limiter.reset( in DoWrite()
4525 thread->stats.AddBytes(bytes); in DoWrite()
4528 Status DoDeterministicCompact(ThreadState* thread, in DoDeterministicCompact() argument
4566 DoWrite(thread, write_mode); in DoDeterministicCompact()
4568 DoWrite(thread, UNIQUE_RANDOM); in DoDeterministicCompact()
4623 DoWrite(thread, write_mode); in DoDeterministicCompact()
4625 DoWrite(thread, UNIQUE_RANDOM); in DoDeterministicCompact()
4683 DoWrite(thread, write_mode); in DoDeterministicCompact()
4685 DoWrite(thread, UNIQUE_RANDOM); in DoDeterministicCompact()
4824 (void)thread; in DoDeterministicCompact()
4833 void ReadSequential(ThreadState* thread) { in ReadSequential() argument
4835 ReadSequential(thread, db_.db); in ReadSequential()
4838 ReadSequential(thread, db_with_cfh.db); in ReadSequential()
4843 void ReadSequential(ThreadState* thread, DB* db) { in ReadSequential() argument
4852 thread->stats.FinishedOps(nullptr, db, 1, kRead); in ReadSequential()
4855 if (thread->shared->read_rate_limiter.get() != nullptr && in ReadSequential()
4857 thread->shared->read_rate_limiter->Request(1024, Env::IO_HIGH, in ReadSequential()
4864 thread->stats.AddBytes(bytes); in ReadSequential()
4866 thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + in ReadSequential()
4871 void ReadToRowCache(ThreadState* thread) { in ReadToRowCache() argument
4882 DBWithColumnFamilies* db_with_cfh = SelectDBWithCfh(thread); in ReadToRowCache()
4908 if (thread->shared->read_rate_limiter.get() != nullptr && in ReadToRowCache()
4910 thread->shared->read_rate_limiter->Request( in ReadToRowCache()
4914 thread->stats.FinishedOps(db_with_cfh, db_with_cfh->db, 1, kRead); in ReadToRowCache()
4921 thread->stats.AddBytes(bytes); in ReadToRowCache()
4922 thread->stats.AddMessage(msg); in ReadToRowCache()
4925 thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + in ReadToRowCache()
4930 void ReadReverse(ThreadState* thread) { in ReadReverse() argument
4932 ReadReverse(thread, db_.db); in ReadReverse()
4935 ReadReverse(thread, db_with_cfh.db); in ReadReverse()
4940 void ReadReverse(ThreadState* thread, DB* db) { in ReadReverse() argument
4946 thread->stats.FinishedOps(nullptr, db, 1, kRead); in ReadReverse()
4948 if (thread->shared->read_rate_limiter.get() != nullptr && in ReadReverse()
4950 thread->shared->read_rate_limiter->Request(1024, Env::IO_HIGH, in ReadReverse()
4956 thread->stats.AddBytes(bytes); in ReadReverse()
4959 void ReadRandomFast(ThreadState* thread) { in ReadRandomFast() argument
4967 DB* db = SelectDBWithCfh(thread)->db; in ReadRandomFast()
4977 int64_t key_rand = thread->rand.Next() & (pot - 1); in ReadRandomFast()
4992 if (thread->shared->read_rate_limiter.get() != nullptr) { in ReadRandomFast()
4993 thread->shared->read_rate_limiter->Request( in ReadRandomFast()
4997 thread->stats.FinishedOps(nullptr, db, 100, kRead); in ReadRandomFast()
5005 thread->stats.AddMessage(msg); in ReadRandomFast()
5008 thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + in ReadRandomFast()
5034 void ReadRandom(ThreadState* thread) { in ReadRandom() argument
5039 int64_t key_rand = GetRandomKey(&thread->rand); in ReadRandom()
5047 DBWithColumnFamilies* db_with_cfh = SelectDBWithCfh(thread); in ReadRandom()
5055 key_rand = GetRandomKey(&thread->rand); in ReadRandom()
5064 key_rand = GetRandomKey(&thread->rand); in ReadRandom()
5085 if (thread->shared->read_rate_limiter.get() != nullptr && in ReadRandom()
5087 thread->shared->read_rate_limiter->Request( in ReadRandom()
5091 thread->stats.FinishedOps(db_with_cfh, db_with_cfh->db, 1, kRead); in ReadRandom()
5098 thread->stats.AddBytes(bytes); in ReadRandom()
5099 thread->stats.AddMessage(msg); in ReadRandom()
5102 thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + in ReadRandom()
5109 void MultiReadRandom(ThreadState* thread) { in MultiReadRandom() argument
5127 DB* db = SelectDB(thread); in MultiReadRandom()
5129 int64_t key = GetRandomKey(&thread->rand); in MultiReadRandom()
5140 GenerateKeyFromInt(GetRandomKey(&thread->rand), FLAGS_num, &keys[i]); in MultiReadRandom()
5176 if (thread->shared->read_rate_limiter.get() != nullptr && in MultiReadRandom()
5178 thread->shared->read_rate_limiter->Request( in MultiReadRandom()
5182 thread->stats.FinishedOps(nullptr, db, entries_per_batch_, kRead); in MultiReadRandom()
5188 thread->stats.AddMessage(msg); in MultiReadRandom()
5414 void MixGraph(ThreadState* thread) { in MixGraph() argument
5447 thread->shared->read_rate_limiter.reset(NewGenericRateLimiter( in MixGraph()
5450 thread->shared->write_rate_limiter.reset( in MixGraph()
5465 DBWithColumnFamilies* db_with_cfh = SelectDBWithCfh(thread); in MixGraph()
5467 ini_rand = GetRandomKey(&thread->rand); in MixGraph()
5486 if (now > thread->stats.GetSineInterval()) { in MixGraph()
5487 usecs_since_last = now - thread->stats.GetSineInterval(); in MixGraph()
5495 static_cast<double>(now - thread->stats.GetStart()); in MixGraph()
5496 thread->stats.ResetSineInterval(); in MixGraph()
5503 thread->shared->write_rate_limiter.reset( in MixGraph()
5505 thread->shared->read_rate_limiter.reset(NewGenericRateLimiter( in MixGraph()
5533 if (thread->shared->read_rate_limiter.get() != nullptr && in MixGraph()
5535 thread->shared->read_rate_limiter->Request( in MixGraph()
5539 thread->stats.FinishedOps(db_with_cfh, db_with_cfh->db, 1, kRead); in MixGraph()
5558 if (thread->shared->write_rate_limiter) { in MixGraph()
5559 thread->shared->write_rate_limiter->Request( in MixGraph()
5563 thread->stats.FinishedOps(db_with_cfh, db_with_cfh->db, 1, kWrite); in MixGraph()
5591 thread->stats.FinishedOps(db_with_cfh, db_with_cfh->db, 1, kSeek); in MixGraph()
5600 thread->stats.AddBytes(bytes); in MixGraph()
5601 thread->stats.AddMessage(msg); in MixGraph()
5604 thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + in MixGraph()
5609 void IteratorCreation(ThreadState* thread) { in IteratorCreation() argument
5613 DB* db = SelectDB(thread); in IteratorCreation()
5616 thread->stats.FinishedOps(nullptr, db, 1, kOthers); in IteratorCreation()
5620 void IteratorCreationWhileWriting(ThreadState* thread) { in IteratorCreationWhileWriting() argument
5621 if (thread->tid > 0) { in IteratorCreationWhileWriting()
5622 IteratorCreation(thread); in IteratorCreationWhileWriting()
5624 BGWriter(thread, kWrite); in IteratorCreationWhileWriting()
5628 void SeekRandom(ThreadState* thread) { in SeekRandom() argument
5659 int64_t seek_pos = thread->rand.Next() % FLAGS_num; in SeekRandom()
5695 iter_to_use = multi_iters[thread->rand.Next() % multi_iters.size()]; in SeekRandom()
5719 if (thread->shared->read_rate_limiter.get() != nullptr && in SeekRandom()
5721 thread->shared->read_rate_limiter->Request( in SeekRandom()
5725 thread->stats.FinishedOps(&db_, db_.db, 1, kSeek); in SeekRandom()
5735 thread->stats.AddBytes(bytes); in SeekRandom()
5736 thread->stats.AddMessage(msg); in SeekRandom()
5738 thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + in SeekRandom()
5743 void SeekRandomWhileWriting(ThreadState* thread) { in SeekRandomWhileWriting() argument
5744 if (thread->tid > 0) { in SeekRandomWhileWriting()
5745 SeekRandom(thread); in SeekRandomWhileWriting()
5747 BGWriter(thread, kWrite); in SeekRandomWhileWriting()
5751 void SeekRandomWhileMerging(ThreadState* thread) { in SeekRandomWhileMerging() argument
5752 if (thread->tid > 0) { in SeekRandomWhileMerging()
5753 SeekRandom(thread); in SeekRandomWhileMerging()
5755 BGWriter(thread, kMerge); in SeekRandomWhileMerging()
5759 void DoDelete(ThreadState* thread, bool seq) { in DoDelete() argument
5767 DB* db = SelectDB(thread); in DoDelete()
5770 const int64_t k = seq ? i + j : (thread->rand.Next() % FLAGS_num); in DoDelete()
5775 thread->stats.FinishedOps(nullptr, db, entries_per_batch_, kDelete); in DoDelete()
5784 void DeleteSeq(ThreadState* thread) { in DeleteSeq() argument
5785 DoDelete(thread, true); in DeleteSeq()
5788 void DeleteRandom(ThreadState* thread) { in DeleteRandom() argument
5789 DoDelete(thread, false); in DeleteRandom()
5792 void ReadWhileWriting(ThreadState* thread) { in ReadWhileWriting() argument
5793 if (thread->tid > 0) { in ReadWhileWriting()
5794 ReadRandom(thread); in ReadWhileWriting()
5796 BGWriter(thread, kWrite); in ReadWhileWriting()
5800 void ReadWhileMerging(ThreadState* thread) { in ReadWhileMerging() argument
5801 if (thread->tid > 0) { in ReadWhileMerging()
5802 ReadRandom(thread); in ReadWhileMerging()
5804 BGWriter(thread, kMerge); in ReadWhileMerging()
5808 void BGWriter(ThreadState* thread, enum OperationType write_merge) { in BGWriter() argument
5820 thread->stats.SetExcludeFromMerge(); in BGWriter()
5828 DB* db = SelectDB(thread); in BGWriter()
5830 MutexLock l(&thread->shared->mu); in BGWriter()
5835 if (thread->shared->num_done + 1 >= thread->shared->num_initialized) { in BGWriter()
5851 GenerateKeyFromInt(thread->rand.Next() % FLAGS_num, FLAGS_num, &key); in BGWriter()
5867 thread->stats.FinishedOps(&db_, db_.db, 1, kWrite); in BGWriter()
5875 thread->stats.AddBytes(bytes); in BGWriter()
5878 void ReadWhileScanning(ThreadState* thread) { in ReadWhileScanning() argument
5879 if (thread->tid > 0) { in ReadWhileScanning()
5880 ReadRandom(thread); in ReadWhileScanning()
5882 BGScan(thread); in ReadWhileScanning()
5886 void BGScan(ThreadState* thread) { in BGScan() argument
5912 thread->stats.FinishedOps(&db_, db_.db, 1, kSeek); in BGScan()
6001 void RandomWithVerify(ThreadState* thread) { in RandomWithVerify() argument
6018 DB* db = SelectDB(thread); in RandomWithVerify()
6025 GenerateKeyFromInt(thread->rand.Next() % FLAGS_numdistinct, in RandomWithVerify()
6039 thread->stats.FinishedOps(&db_, db_.db, 1, kRead); in RandomWithVerify()
6050 thread->stats.FinishedOps(&db_, db_.db, 1, kWrite); in RandomWithVerify()
6059 thread->stats.FinishedOps(&db_, db_.db, 1, kDelete); in RandomWithVerify()
6067 thread->stats.AddMessage(msg); in RandomWithVerify()
6072 void ReadRandomWriteRandom(ThreadState* thread) { in ReadRandomWriteRandom() argument
6088 DB* db = SelectDB(thread); in ReadRandomWriteRandom()
6089 GenerateKeyFromInt(thread->rand.Next() % FLAGS_num, FLAGS_num, &key); in ReadRandomWriteRandom()
6107 thread->stats.FinishedOps(nullptr, db, 1, kRead); in ReadRandomWriteRandom()
6118 thread->stats.FinishedOps(nullptr, db, 1, kWrite); in ReadRandomWriteRandom()
6125 thread->stats.AddMessage(msg); in ReadRandomWriteRandom()
6130 void UpdateRandom(ThreadState* thread) { in UpdateRandom() argument
6142 DB* db = SelectDB(thread); in UpdateRandom()
6143 GenerateKeyFromInt(thread->rand.Next() % FLAGS_num, FLAGS_num, &key); in UpdateRandom()
6155 if (thread->shared->write_rate_limiter) { in UpdateRandom()
6156 thread->shared->write_rate_limiter->Request( in UpdateRandom()
6168 thread->stats.FinishedOps(nullptr, db, 1, kUpdate); in UpdateRandom()
6173 thread->stats.AddBytes(bytes); in UpdateRandom()
6174 thread->stats.AddMessage(msg); in UpdateRandom()
6181 void XORUpdateRandom(ThreadState* thread) { in XORUpdateRandom() argument
6194 DB* db = SelectDB(thread); in XORUpdateRandom()
6195 GenerateKeyFromInt(thread->rand.Next() % FLAGS_num, FLAGS_num, &key); in XORUpdateRandom()
6221 thread->stats.FinishedOps(nullptr, db, 1); in XORUpdateRandom()
6226 thread->stats.AddMessage(msg); in XORUpdateRandom()
6232 void AppendRandom(ThreadState* thread) { in AppendRandom() argument
6244 DB* db = SelectDB(thread); in AppendRandom()
6245 GenerateKeyFromInt(thread->rand.Next() % FLAGS_num, FLAGS_num, &key); in AppendRandom()
6275 thread->stats.FinishedOps(nullptr, db, 1, kUpdate); in AppendRandom()
6281 thread->stats.AddBytes(bytes); in AppendRandom()
6282 thread->stats.AddMessage(msg); in AppendRandom()
6295 void MergeRandom(ThreadState* thread) { in MergeRandom() argument
6303 DBWithColumnFamilies* db_with_cfh = SelectDBWithCfh(thread); in MergeRandom()
6304 int64_t key_rand = thread->rand.Next() % merge_keys_; in MergeRandom()
6324 thread->stats.FinishedOps(nullptr, db_with_cfh->db, 1, kMerge); in MergeRandom()
6330 thread->stats.AddBytes(bytes); in MergeRandom()
6331 thread->stats.AddMessage(msg); in MergeRandom()
6341 void ReadRandomMergeRandom(ThreadState* thread) { in ReadRandomMergeRandom() argument
6355 DB* db = SelectDB(thread); in ReadRandomMergeRandom()
6356 GenerateKeyFromInt(thread->rand.Next() % merge_keys_, merge_keys_, &key); in ReadRandomMergeRandom()
6358 bool do_merge = int(thread->rand.Next() % 100) < FLAGS_mergereadpercent; in ReadRandomMergeRandom()
6367 thread->stats.FinishedOps(nullptr, db, 1, kMerge); in ReadRandomMergeRandom()
6381 thread->stats.FinishedOps(nullptr, db, 1, kRead); in ReadRandomMergeRandom()
6390 thread->stats.AddMessage(msg); in ReadRandomMergeRandom()
6393 void WriteSeqSeekSeq(ThreadState* thread) { in WriteSeqSeekSeq() argument
6395 DoWrite(thread, SEQUENTIAL); in WriteSeqSeekSeq()
6397 thread->stats.Start(thread->tid); in WriteSeqSeekSeq()
6399 DB* db = SelectDB(thread); in WriteSeqSeekSeq()
6409 thread->stats.FinishedOps(nullptr, db, 1, kSeek); in WriteSeqSeekSeq()
6419 thread->stats.FinishedOps(nullptr, db, 1, kSeek); in WriteSeqSeekSeq()
6424 thread->stats.FinishedOps(nullptr, db, 1, kSeek); in WriteSeqSeekSeq()
6447 void GetMergeOperands(ThreadState* thread) { in GetMergeOperands() argument
6448 DB* db = SelectDB(thread); in GetMergeOperands()
6532 void RandomTransaction(ThreadState* thread) { in RandomTransaction() argument
6548 RandomTransactionInserter inserter(&thread->rand, write_options_, in RandomTransaction()
6579 thread->stats.FinishedOps(nullptr, db_.db, 1, kOthers); in RandomTransaction()
6591 thread->stats.AddMessage(msg); in RandomTransaction()
6594 thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + in RandomTransaction()
6597 thread->stats.AddBytes(static_cast<int64_t>(inserter.GetBytesInserted())); in RandomTransaction()
6626 void RandomReplaceKeys(ThreadState* thread) { in RandomReplaceKeys() argument
6634 DB* db = SelectDB(thread); in RandomReplaceKeys()
6670 thread->stats.FinishedOps(nullptr, db, 1, kOthers); in RandomReplaceKeys()
6678 thread->stats.AddMessage(msg); in RandomReplaceKeys()
6681 void TimeSeriesReadOrDelete(ThreadState* thread, bool do_deletion) { in TimeSeriesReadOrDelete() argument
6698 MutexLock l(&thread->shared->mu); in TimeSeriesReadOrDelete()
6699 if (thread->shared->num_done >= 1) { in TimeSeriesReadOrDelete()
6710 int64_t key_id = thread->rand.Next() % FLAGS_key_id_range; in TimeSeriesReadOrDelete()
6727 thread->stats.FinishedOps(&db_, db_.db, 1, kDelete); in TimeSeriesReadOrDelete()
6734 thread->stats.FinishedOps(&db_, db_.db, 1, kRead); in TimeSeriesReadOrDelete()
6744 if (thread->shared->read_rate_limiter.get() != nullptr) { in TimeSeriesReadOrDelete()
6745 thread->shared->read_rate_limiter->Request( in TimeSeriesReadOrDelete()
6754 thread->stats.AddBytes(bytes); in TimeSeriesReadOrDelete()
6755 thread->stats.AddMessage(msg); in TimeSeriesReadOrDelete()
6757 thread->stats.AddMessage(std::string("PERF_CONTEXT:\n") + in TimeSeriesReadOrDelete()
6762 void TimeSeriesWrite(ThreadState* thread) { in TimeSeriesWrite() argument
6768 thread->stats.SetExcludeFromMerge(); in TimeSeriesWrite()
6781 DB* db = SelectDB(thread); in TimeSeriesWrite()
6783 uint64_t key_id = thread->rand.Next() % FLAGS_key_id_range; in TimeSeriesWrite()
6812 thread->stats.FinishedOps(&db_, db_.db, 1, kWrite); in TimeSeriesWrite()
6813 thread->stats.AddBytes(bytes); in TimeSeriesWrite()
6823 void TimeSeries(ThreadState* thread) { in TimeSeries() argument
6824 if (thread->tid > 0) { in TimeSeries()
6826 thread->tid <= FLAGS_num_deletion_threads; in TimeSeries()
6827 TimeSeriesReadOrDelete(thread, do_deletion); in TimeSeries()
6829 TimeSeriesWrite(thread); in TimeSeries()
6830 thread->stats.Stop(); in TimeSeries()
6831 thread->stats.Report("timeseries write"); in TimeSeries()
6835 void Compact(ThreadState* thread) { in Compact() argument
6836 DB* db = SelectDB(thread); in Compact()
6914 void Replay(ThreadState* thread) { in Replay() argument
6916 Replay(thread, &db_); in Replay()