aboutsummaryrefslogtreecommitdiff
path: root/test/fake_producer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/fake_producer.cc')
-rw-r--r--test/fake_producer.cc19
1 files changed, 4 insertions, 15 deletions
diff --git a/test/fake_producer.cc b/test/fake_producer.cc
index f716c906e..2fc18a32e 100644
--- a/test/fake_producer.cc
+++ b/test/fake_producer.cc
@@ -17,18 +17,16 @@
#include "test/fake_producer.h"
#include <mutex>
-#include <thread>
#include "perfetto/base/logging.h"
#include "perfetto/base/time.h"
#include "perfetto/ext/base/utils.h"
+#include "perfetto/ext/traced/traced.h"
#include "perfetto/ext/tracing/core/commit_data_request.h"
#include "perfetto/ext/tracing/core/shared_memory_arbiter.h"
#include "perfetto/ext/tracing/core/trace_packet.h"
#include "perfetto/ext/tracing/core/trace_writer.h"
#include "perfetto/tracing/core/data_source_config.h"
-#include "src/ipc/client_impl.h"
-#include "src/tracing/ipc/producer/producer_ipc_client_impl.h"
#include "protos/perfetto/config/test_config.gen.h"
#include "protos/perfetto/trace/test_event.pbzero.h"
@@ -56,7 +54,7 @@ void FakeProducer::Connect(const char* socket_name,
socket_name, this, "android.perfetto.FakeProducer", task_runner_,
TracingService::ProducerSMBScrapingMode::kDefault,
/*shared_memory_size_hint_bytes=*/0,
- /*shared_memory_page_size_hint_bytes=*/4096, std::move(shm),
+ /*shared_memory_page_size_hint_bytes=*/base::kPageSize, std::move(shm),
std::move(shm_arbiter));
on_connect_ = std::move(on_connect);
on_setup_data_source_instance_ = std::move(on_setup_data_source_instance);
@@ -162,15 +160,6 @@ void FakeProducer::Flush(FlushRequestID flush_request_id,
endpoint_->NotifyFlushComplete(flush_request_id);
}
-base::SocketHandle FakeProducer::unix_socket_fd() {
- // Since FakeProducer is only used in tests we can include and assume the
- // implementation.
- auto* producer = static_cast<ProducerIPCClientImpl*>(endpoint_.get());
- auto* ipc_client =
- static_cast<ipc::ClientImpl*>(producer->GetClientForTesting());
- return ipc_client->GetUnixSocketForTesting()->fd();
-}
-
void FakeProducer::SetupFromConfig(const protos::gen::TestConfig& config) {
rnd_engine_ = std::minstd_rand0(config.seed());
message_count_ = config.message_count();
@@ -211,8 +200,8 @@ void FakeProducer::EmitEventBatchOnTaskRunner(std::function<void()> callback) {
int64_t expected_time_taken = iterations * 1000;
base::TimeMillis time_taken = base::GetWallTimeMs() - start;
while (time_taken.count() < expected_time_taken) {
- std::this_thread::sleep_for(
- base::TimeMillis(expected_time_taken - time_taken.count()));
+ usleep(static_cast<useconds_t>(
+ (expected_time_taken - time_taken.count()) * 1000));
time_taken = base::GetWallTimeMs() - start;
}
}