Welcome to mirror list, hosted at ThFree Co, Russian Federation.

utils_8hpp.html - github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: af4e4f1fd7e64b320bc7a00c900df0ac3b3fdefe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LLFIO: include/llfio/v2.0/utils.hpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LLFIO
   &#160;<span id="projectnumber">v2.00 late alpha</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('utils_8hpp.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#namespaces">Namespaces</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">utils.hpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Provides namespace utils.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="config_8hpp.html">config.hpp</a>&quot;</code><br />
<code>#include &quot;quickcpplib/include/algorithm/string.hpp&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classllfio__v2__xxx_1_1utils_1_1page__allocator.html">llfio_v2_xxx::utils::page_allocator&lt; T &gt;</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">An STL allocator which allocates large TLB page memory.If the operating system is configured to allow it, this type of memory is particularly efficient for doing large scale file i/o. This is because the kernel must normally convert the scatter gather buffers you pass into extended scatter gather buffers as the memory you see as contiguous may not, and probably isn't, actually be contiguous in physical memory. Regions returned by this allocator <em>may</em> be allocated contiguously in physical memory and therefore the kernel can pass through your scatter gather buffers unmodified.  <a href="classllfio__v2__xxx_1_1utils_1_1page__allocator.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structllfio__v2__xxx_1_1utils_1_1page__allocator_1_1rebind.html">llfio_v2_xxx::utils::page_allocator&lt; T &gt;::rebind&lt; U &gt;</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classllfio__v2__xxx_1_1utils_1_1page__allocator_3_01void_01_4.html">llfio_v2_xxx::utils::page_allocator&lt; void &gt;</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structllfio__v2__xxx_1_1utils_1_1page__allocator_3_01void_01_4_1_1rebind.html">llfio_v2_xxx::utils::page_allocator&lt; void &gt;::rebind&lt; U &gt;</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespacellfio__v2__xxx"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx.html">llfio_v2_xxx</a></td></tr>
<tr class="memdesc:namespacellfio__v2__xxx"><td class="mdescLeft">&#160;</td><td class="mdescRight">The LLFIO namespace. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:namespacellfio__v2__xxx_1_1utils"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html">llfio_v2_xxx::utils</a></td></tr>
<tr class="memdesc:namespacellfio__v2__xxx_1_1utils"><td class="mdescLeft">&#160;</td><td class="mdescRight">Utility routines often useful when using LLFIO. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a42fc69cae3dbbf66498545cbe358e2ba"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#a42fc69cae3dbbf66498545cbe358e2ba">llfio_v2_xxx::utils::page_size</a> () noexcept</td></tr>
<tr class="memdesc:a42fc69cae3dbbf66498545cbe358e2ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the smallest page size of this architecture which is useful for calculating direct i/o multiples.  <a href="namespacellfio__v2__xxx_1_1utils.html#a42fc69cae3dbbf66498545cbe358e2ba">More...</a><br /></td></tr>
<tr class="separator:a42fc69cae3dbbf66498545cbe358e2ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5499feaf6b774e774a26e7decd11e3fa"><td class="memTemplParams" colspan="2"><a id="a5499feaf6b774e774a26e7decd11e3fa"></a>
template&lt;class T &gt; </td></tr>
<tr class="memitem:a5499feaf6b774e774a26e7decd11e3fa"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#a5499feaf6b774e774a26e7decd11e3fa">llfio_v2_xxx::utils::round_down_to_page_size</a> (T i, size_t pagesize) noexcept</td></tr>
<tr class="memdesc:a5499feaf6b774e774a26e7decd11e3fa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Round a value to its next lowest page size multiple. <br /></td></tr>
<tr class="separator:a5499feaf6b774e774a26e7decd11e3fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a67f8f31f6b93293a22a4b30d686eb3af"><td class="memTemplParams" colspan="2"><a id="a67f8f31f6b93293a22a4b30d686eb3af"></a>
template&lt;class T &gt; </td></tr>
<tr class="memitem:a67f8f31f6b93293a22a4b30d686eb3af"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#a67f8f31f6b93293a22a4b30d686eb3af">llfio_v2_xxx::utils::round_up_to_page_size</a> (T i, size_t pagesize) noexcept</td></tr>
<tr class="memdesc:a67f8f31f6b93293a22a4b30d686eb3af"><td class="mdescLeft">&#160;</td><td class="mdescRight">Round a value to its next highest page size multiple. <br /></td></tr>
<tr class="separator:a67f8f31f6b93293a22a4b30d686eb3af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afa36e8bc2a1f004696c09d104e23d685"><td class="memTemplParams" colspan="2"><a id="afa36e8bc2a1f004696c09d104e23d685"></a>
template&lt;class T &gt; </td></tr>
<tr class="memitem:afa36e8bc2a1f004696c09d104e23d685"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#afa36e8bc2a1f004696c09d104e23d685">llfio_v2_xxx::utils::round_to_page_size</a> (T i, size_t pagesize) noexcept</td></tr>
<tr class="memdesc:afa36e8bc2a1f004696c09d104e23d685"><td class="mdescLeft">&#160;</td><td class="mdescRight">Round a pair of a pointer and a size_t to their nearest page size multiples. The pointer will be rounded down, the size_t upwards. <br /></td></tr>
<tr class="separator:afa36e8bc2a1f004696c09d104e23d685"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c41e314d4d4b8362b96a3b4c1c363f5"><td class="memItemLeft" align="right" valign="top">const std::vector&lt; size_t &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#a6c41e314d4d4b8362b96a3b4c1c363f5">llfio_v2_xxx::utils::page_sizes</a> (bool only_actually_available=true)</td></tr>
<tr class="memdesc:a6c41e314d4d4b8362b96a3b4c1c363f5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the page sizes of this architecture which is useful for calculating direct i/o multiples.  <a href="namespacellfio__v2__xxx_1_1utils.html#a6c41e314d4d4b8362b96a3b4c1c363f5">More...</a><br /></td></tr>
<tr class="separator:a6c41e314d4d4b8362b96a3b4c1c363f5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a90d8f94ddb6e026f931e86d0dc904778"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#a90d8f94ddb6e026f931e86d0dc904778">llfio_v2_xxx::utils::file_buffer_default_size</a> ()</td></tr>
<tr class="memdesc:a90d8f94ddb6e026f931e86d0dc904778"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a reasonable default size for page_allocator, typically the closest page size from page_sizes() to 1Mb.  <a href="namespacellfio__v2__xxx_1_1utils.html#a90d8f94ddb6e026f931e86d0dc904778">More...</a><br /></td></tr>
<tr class="separator:a90d8f94ddb6e026f931e86d0dc904778"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae61e2de30b06776a1c24643a1d1dc64e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#ae61e2de30b06776a1c24643a1d1dc64e">llfio_v2_xxx::utils::random_fill</a> (char *buffer, size_t bytes) noexcept</td></tr>
<tr class="memdesc:ae61e2de30b06776a1c24643a1d1dc64e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fills the buffer supplied with cryptographically strong randomness. Uses the OS kernel API.  <a href="namespacellfio__v2__xxx_1_1utils.html#ae61e2de30b06776a1c24643a1d1dc64e">More...</a><br /></td></tr>
<tr class="separator:ae61e2de30b06776a1c24643a1d1dc64e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6a29cf29a4b097411f6c1e5274bfb417"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#a6a29cf29a4b097411f6c1e5274bfb417">llfio_v2_xxx::utils::random_string</a> (size_t randomlen)</td></tr>
<tr class="memdesc:a6a29cf29a4b097411f6c1e5274bfb417"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a cryptographically random string capable of being used as a filename. Essentially random_fill() + to_hex_string().  <a href="namespacellfio__v2__xxx_1_1utils.html#a6a29cf29a4b097411f6c1e5274bfb417">More...</a><br /></td></tr>
<tr class="separator:a6a29cf29a4b097411f6c1e5274bfb417"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae1d9ee5d6d391f39f62dacbc8c957ae8"><td class="memItemLeft" align="right" valign="top"><a id="ae1d9ee5d6d391f39f62dacbc8c957ae8"></a>
result&lt; void &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#ae1d9ee5d6d391f39f62dacbc8c957ae8">llfio_v2_xxx::utils::flush_modified_data</a> () noexcept</td></tr>
<tr class="memdesc:ae1d9ee5d6d391f39f62dacbc8c957ae8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Tries to flush all modified data to the physical device. <br /></td></tr>
<tr class="separator:ae1d9ee5d6d391f39f62dacbc8c957ae8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abacefaf60ae391226c4775cf8a61276a"><td class="memItemLeft" align="right" valign="top">result&lt; void &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#abacefaf60ae391226c4775cf8a61276a">llfio_v2_xxx::utils::drop_filesystem_cache</a> () noexcept</td></tr>
<tr class="memdesc:abacefaf60ae391226c4775cf8a61276a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Tries to flush all modified data to the physical device, and then drop the OS filesystem cache, thus making all future reads come from the physical device. Currently only implemented for Microsoft Windows and Linux.  <a href="namespacellfio__v2__xxx_1_1utils.html#abacefaf60ae391226c4775cf8a61276a">More...</a><br /></td></tr>
<tr class="separator:abacefaf60ae391226c4775cf8a61276a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7aae80908cc5521ef67234152c5c5044"><td class="memItemLeft" align="right" valign="top"><a id="a7aae80908cc5521ef67234152c5c5044"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacellfio__v2__xxx_1_1utils.html#a7aae80908cc5521ef67234152c5c5044">llfio_v2_xxx::utils::running_under_wsl</a> () noexcept</td></tr>
<tr class="memdesc:a7aae80908cc5521ef67234152c5c5044"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns true if this POSIX is running under Microsoft's Subsystem for Linux. <br /></td></tr>
<tr class="separator:a7aae80908cc5521ef67234152c5c5044"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acf1b1646f257d85f7f2655df1042483f"><td class="memItemLeft" align="right" valign="top"><a id="acf1b1646f257d85f7f2655df1042483f"></a>
large_page_allocation&#160;</td><td class="memItemRight" valign="bottom"><b>llfio_v2_xxx::utils::detail::calculate_large_page_allocation</b> (size_t bytes)</td></tr>
<tr class="separator:acf1b1646f257d85f7f2655df1042483f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a85afc40cff0ecfd3a13520ea7e5176a1"><td class="memItemLeft" align="right" valign="top"><a id="a85afc40cff0ecfd3a13520ea7e5176a1"></a>
large_page_allocation&#160;</td><td class="memItemRight" valign="bottom"><b>llfio_v2_xxx::utils::detail::allocate_large_pages</b> (size_t bytes)</td></tr>
<tr class="separator:a85afc40cff0ecfd3a13520ea7e5176a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2305cf865b7952f58aba997c4ac95efb"><td class="memItemLeft" align="right" valign="top"><a id="a2305cf865b7952f58aba997c4ac95efb"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>llfio_v2_xxx::utils::detail::deallocate_large_pages</b> (void *p, size_t bytes)</td></tr>
<tr class="separator:a2305cf865b7952f58aba997c4ac95efb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae880ebd5681dcf6b700d67fb10b4547e"><td class="memTemplParams" colspan="2"><a id="ae880ebd5681dcf6b700d67fb10b4547e"></a>
template&lt;class T , class U &gt; </td></tr>
<tr class="memitem:ae880ebd5681dcf6b700d67fb10b4547e"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><b>llfio_v2_xxx::utils::operator==</b> (const page_allocator&lt; T &gt; &amp;, const page_allocator&lt; U &gt; &amp;) noexcept</td></tr>
<tr class="separator:ae880ebd5681dcf6b700d67fb10b4547e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Provides namespace utils. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_9ffbcff25eb6a2bb8ed044f6c5d983c9.html">llfio</a></li><li class="navelem"><a class="el" href="dir_ff8d8ad368a820031e12dd9b12d79036.html">v2.0</a></li><li class="navelem"><a class="el" href="utils_8hpp.html">utils.hpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>