chromium/net/websockets/websocket_frame_perftest.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include <stddef.h>

#include <iterator>
#include <string>
#include <string_view>
#include <vector>

#include "base/ranges/algorithm.h"
#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
#include "net/websockets/websocket_frame.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_result_reporter.h"

namespace net {

namespace {

constexpr int kIterations =;
constexpr int kLongPayloadSize =;
constexpr std::string_view kMaskingKey =;

static constexpr char kMetricPrefixWebSocketFrame[] =;
static constexpr char kMetricMaskTimeMs[] =;

perf_test::PerfResultReporter SetUpWebSocketFrameMaskReporter(
    const std::string& story) {}

static_assert;

class WebSocketFrameTestMaskBenchmark : public ::testing::Test {};

TEST_F(WebSocketFrameTestMaskBenchmark, BenchmarkMaskShortPayload) {}

TEST_F(WebSocketFrameTestMaskBenchmark, BenchmarkMaskLongPayload) {}

// A 31-byte payload is guaranteed to do 7 byte mask operations and 3 vector
// mask operations with an 8-byte vector. With a 16-byte vector it will fall
// back to the byte-only code path and do 31 byte mask operations.
TEST_F(WebSocketFrameTestMaskBenchmark, Benchmark31BytePayload) {}

}  // namespace

}  // namespace net