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

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-08-20 21:05:22 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-08-20 21:05:22 +0300
commitd3ff87fd8b91f06d4f7bd240860ef68f15a03621 (patch)
tree2d3c76783e80044842c11ea2929fc32eef0a90c9
parentbe9a125ab6a9eb2ae27ec2730166c9ecf4eafe8f (diff)
parent5fc220fb1d39da11c9d41fdd6611e4455cc22eba (diff)
Merge branch 'develop' of github.com:ned14/llfio into develop
-rw-r--r--include/llfio/v2.0/detail/impl/posix/utils.ipp47
1 files changed, 23 insertions, 24 deletions
diff --git a/include/llfio/v2.0/detail/impl/posix/utils.ipp b/include/llfio/v2.0/detail/impl/posix/utils.ipp
index d0b21ba2..7b734a45 100644
--- a/include/llfio/v2.0/detail/impl/posix/utils.ipp
+++ b/include/llfio/v2.0/detail/impl/posix/utils.ipp
@@ -28,6 +28,8 @@ Distributed under the Boost Software License, Version 1.0.
#include <sys/mman.h>
+// #include <iostream>
+
#ifdef __linux__
#include <unistd.h> // for preadv
#endif
@@ -267,35 +269,31 @@ namespace utils
std::vector<string_view> anon_entries, non_anon_entries;
anon_entries.reserve(32);
non_anon_entries.reserve(32);
- auto sizeidx = totalview.find("\nSize:");
- while(sizeidx < totalview.size())
- {
- auto itemtopidx = totalview.rfind("\n", sizeidx - 1);
- if(string_view::npos == itemtopidx)
- {
- itemtopidx = 0;
- }
- // hexaddr-hexaddr flags offset dev:id inode [path]
- size_t begin, end, offset, inode = 1;
- char f1, f2, f3, f4, f5, f6, f7, f8;
- sscanf(totalview.data() + itemtopidx, "%zx-%zx %c%c%c%c %zx %c%c:%c%c %zu", &begin, &end, &f1, &f2, &f3, &f4, &offset, &f5, &f6, &f7, &f8, &inode);
- sizeidx = totalview.find("\nSize:", sizeidx + 1);
- if(string_view::npos == sizeidx)
+ auto find_item = [&](size_t idx) -> string_view {
+ auto x = totalview.rfind("\nSize:", idx);
+ if(x == string_view::npos)
{
- sizeidx = totalview.size();
+ return {};
}
- auto itemendidx = totalview.rfind("\n", sizeidx - 1);
- if(string_view::npos == itemendidx)
+ x = totalview.rfind("\n", x - 1);
+ if(x == string_view::npos)
{
- abort();
+ x = 0;
}
- const string_view item(totalview.substr(itemtopidx + 1, itemendidx - itemtopidx - 1));
- auto vmflagsidx = item.rfind("\n");
- if(string_view::npos == itemendidx)
+ else
{
- abort();
+ x++;
}
- if(0 != memcmp(item.data() + vmflagsidx, "\nVmFlags:", 9))
+ return totalview.substr(x, idx - x);
+ };
+ for(string_view item = find_item(totalview.size()); item != string_view(); item = find_item(item.data() - totalview.data()))
+ {
+ //std::cout << "***" << item << "***";
+ // hexaddr-hexaddr flags offset dev:id inode [path]
+ size_t inode = 1;
+ sscanf(item.data(), "%*x-%*x %*c%*c%*c%*c %*x %*c%*c:%*c%*c %zu", &inode);
+ auto vmflagsidx = item.rfind("\nVmFlags:");
+ if(vmflagsidx == string_view::npos)
{
return errc::illegal_byte_sequence;
}
@@ -559,7 +557,8 @@ namespace utils
mach_timebase_info_data_t timebase;
mach_timebase_info(&timebase);
return (double) timebase.numer / timebase.denom;
- }();*/ 10000000.0; // no idea why, but apparently this is the multiplier according to Mac CI runners
+ }();*/
+ 10000000.0; // no idea why, but apparently this is the multiplier according to Mac CI runners
ret.system_ns_in_user_mode = (uint64_t)(ts_multiplier * ret.system_ns_in_user_mode);
ret.system_ns_in_kernel_mode = (uint64_t)(ts_multiplier * ret.system_ns_in_kernel_mode);
ret.system_ns_in_idle_mode = (uint64_t)(ts_multiplier * ret.system_ns_in_idle_mode);