1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_PREFETCH_H_
6 #define QUICHE_QUIC_PLATFORM_API_QUIC_PREFETCH_H_
7 
8 #include "net/quic/platform/impl/quic_prefetch_impl.h"
9 
10 namespace quic {
11 
12 // Move data into the cache before it is read, or "prefetch" it.
13 //
14 // The value of `addr` is the address of the memory to prefetch. If
15 // the target and compiler support it, data prefetch instructions are
16 // generated. If the prefetch is done some time before the memory is
17 // read, it may be in the cache by the time the read occurs.
18 //
19 // The function names specify the temporal locality heuristic applied,
20 // using the names of Intel prefetch instructions:
21 //
22 //   T0 - high degree of temporal locality; data should be left in as
23 //        many levels of the cache possible
24 //   T1 - moderate degree of temporal locality
25 //   T2 - low degree of temporal locality
26 //   Nta - no temporal locality, data need not be left in the cache
27 //         after the read
28 //
29 // Incorrect or gratuitous use of these functions can degrade
30 // performance, so use them only when representative benchmarks show
31 // an improvement.
32 
QuicPrefetchT0(const void * addr)33 inline void QuicPrefetchT0(const void* addr) {
34   return QuicPrefetchT0Impl(addr);
35 }
36 
37 }  // namespace quic
38 
39 #endif  // QUICHE_QUIC_PLATFORM_API_QUIC_PREFETCH_H_
40