proxygen
HugePages.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <sys/stat.h>
20 #include <sys/types.h>
21 #include <cstddef>
22 #include <string>
23 #include <utility>
24 #include <vector>
25 
26 #include <boost/operators.hpp>
27 
28 #include <folly/Range.h>
31 
32 namespace folly {
33 
34 struct HugePageSize : private boost::totally_ordered<HugePageSize> {
35  explicit HugePageSize(size_t s) : size(s) {}
36 
37  fs::path filePath(const fs::path& relpath) const {
38  return mountPoint / relpath;
39  }
40 
41  size_t size = 0;
42  fs::path mountPoint;
43  dev_t device = 0;
44 };
45 
46 inline bool operator<(const HugePageSize& a, const HugePageSize& b) {
47  return a.size < b.size;
48 }
49 
50 inline bool operator==(const HugePageSize& a, const HugePageSize& b) {
51  return a.size == b.size;
52 }
53 
59 typedef std::vector<HugePageSize> HugePageSizeVec;
60 
65 const HugePageSizeVec& getHugePageSizes();
66 
72 const HugePageSize* getHugePageSize(size_t size = 0);
73 
79 
80 } // namespace folly
HugePageSize(size_t s)
Definition: HugePages.h:35
const HugePageSizeVec & getHugePageSizes()
Definition: HugePages.cpp:201
char b
fs::path mountPoint
Definition: HugePages.h:42
std::vector< HugePageSize > HugePageSizeVec
Definition: HugePages.h:59
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
const HugePageSize * getHugePageSize(size_t size)
Definition: HugePages.cpp:206
const HugePageSize * getHugePageSizeForDevice(dev_t device)
Definition: HugePages.cpp:219
fs::path filePath(const fs::path &relpath) const
Definition: HugePages.h:37
char a
bool operator==(const Unexpected< Error > &lhs, const Unexpected< Error > &rhs)
Definition: Expected.h:758
static set< string > s
std::enable_if< IsLessThanComparable< Value >::value, bool >::type operator<(const Expected< Value, Error > &lhs, const Expected< Value, Error > &rhs)
Definition: Expected.h:1321