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-03-19 13:58:31 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-03-19 13:58:31 +0300
commit47614988e0f38085b903b55369ec359711494d27 (patch)
tree0fcc1df8e9c88d5cffdd35004984245e8d51a514
parent3354ed31eea1534321d2ea0c05e82e572297609c (diff)
Reenable the llfio::dynamic_thread_pool_group::io_aware_work_item unit test.
-rw-r--r--.gitattributes5
-rw-r--r--include/llfio/revision.hpp6
-rw-r--r--include/llfio/v2.0/detail/impl/posix/statfs.ipp3
-rw-r--r--test/tests/dynamic_thread_pool_group.cpp47
4 files changed, 47 insertions, 14 deletions
diff --git a/.gitattributes b/.gitattributes
index ee812ad4..b292a976 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,6 +1,11 @@
* text=auto !eol svneol=native#text/plain
*.gitattributes text svneol=native#text/plain
+cmake/headers.cmake eol=lf
+cmake/interface.cmake eol=lf
+cmake/sources.cmake eol=lf
+cmake/tests.cmake eol=lf
+
# Scriptish formats
*.bat text svneol=native#text/plain
*.bsh text svneol=native#text/x-beanshell
diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp
index 2cd9f8b5..634724d9 100644
--- a/include/llfio/revision.hpp
+++ b/include/llfio/revision.hpp
@@ -1,4 +1,4 @@
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
-#define LLFIO_PREVIOUS_COMMIT_REF 67226948b9f00aebbf33c232d10c417ba1abb289
-#define LLFIO_PREVIOUS_COMMIT_DATE "2021-03-16 12:31:40 +00:00"
-#define LLFIO_PREVIOUS_COMMIT_UNIQUE 67226948
+#define LLFIO_PREVIOUS_COMMIT_REF 3354ed31eea1534321d2ea0c05e82e572297609c
+#define LLFIO_PREVIOUS_COMMIT_DATE "2021-03-17 16:05:09 +00:00"
+#define LLFIO_PREVIOUS_COMMIT_UNIQUE 3354ed31
diff --git a/include/llfio/v2.0/detail/impl/posix/statfs.ipp b/include/llfio/v2.0/detail/impl/posix/statfs.ipp
index 2e3b0859..d8a00c8e 100644
--- a/include/llfio/v2.0/detail/impl/posix/statfs.ipp
+++ b/include/llfio/v2.0/detail/impl/posix/statfs.ipp
@@ -438,8 +438,7 @@ LLFIO_HEADERS_ONLY_MEMFUNC_SPEC result<std::pair<uint32_t, float>> statfs_t::_fi
int major = 0, minor = 0;
char devicename[64];
size_t fields[12];
- sscanf(sv.data(), "%d %d %s %zu %zu %zu %zu %zu %zu %zu %zu %zu %zu", &major, &minor, devicename, fields + 0, fields + 1, fields + 2, fields + 3,
- fields + 4, fields + 5, fields + 6, fields + 7, fields + 8, fields + 9);
+ sscanf(sv.data(), "%d %d %s %*u %*u %*u %*u %*u %*u %*u %*u %zu %zu", &major, &minor, devicename, fields + 8, fields + 9);
std::lock_guard<std::mutex> g(last_reading.lock);
auto it = last_reading.items.begin();
for(; it != last_reading.items.end(); ++it)
diff --git a/test/tests/dynamic_thread_pool_group.cpp b/test/tests/dynamic_thread_pool_group.cpp
index 66a49425..dcaf292a 100644
--- a/test/tests/dynamic_thread_pool_group.cpp
+++ b/test/tests/dynamic_thread_pool_group.cpp
@@ -346,10 +346,6 @@ static inline void TestDynamicThreadPoolGroupNestingWorks()
static inline void TestDynamicThreadPoolGroupIoAwareWorks()
{
- // statfs_t::iosinprogress not implemented for these yet
-#if defined(__APPLE__) || defined(__FreeBSD__)
- return;
-#endif
namespace llfio = LLFIO_V2_NAMESPACE;
static constexpr size_t WORK_ITEMS = 1000;
static constexpr size_t IO_SIZE = 1 * 65536;
@@ -401,13 +397,46 @@ static inline void TestDynamicThreadPoolGroupIoAwareWorks()
.value();
shared_state.awareness.h = &shared_state.h;
shared_state.h.truncate(WORK_ITEMS * IO_SIZE).value();
+ {
+ auto print_statfs = [](const llfio::file_handle &h, const llfio::statfs_t &statfs) {
+ std::cout << "\nFor file " << h.current_path().value() << ":";
+ std::cout << "\n fundamental filesystem block size = " << statfs.f_bsize;
+ std::cout << "\n optimal transfer block size = " << statfs.f_iosize;
+ std::cout << "\n total data blocks in filesystem = " << statfs.f_blocks;
+ std::cout << "\n free blocks in filesystem = " << statfs.f_bfree;
+ std::cout << "\n free blocks avail to non-superuser = " << statfs.f_bavail;
+ std::cout << "\n total file nodes in filesystem = " << statfs.f_files;
+ std::cout << "\n free nodes avail to non-superuser = " << statfs.f_ffree;
+ std::cout << "\n maximum filename length = " << statfs.f_namemax;
+ std::cout << "\n filesystem type name = " << statfs.f_fstypename;
+ std::cout << "\n mounted filesystem = " << statfs.f_mntfromname;
+ std::cout << "\n directory on which mounted = " << statfs.f_mntonname;
+ std::cout << "\n i/o's currently in progress (i.e. queue depth) = " << statfs.f_iosinprogress;
+ std::cout << "\n percentage of time spent doing i/o (1.0 = 100%) = " << statfs.f_iosbusytime;
+ std::cout << std::endl;
+ };
+ llfio::statfs_t s;
+ s.fill(shared_state.h).value();
+ print_statfs(shared_state.h, s);
+ }
alignas(4096) llfio::byte buffer[IO_SIZE];
llfio::utils::random_fill((char *) buffer, sizeof(buffer));
std::vector<work_item> workitems;
- for(size_t n = 0; n < WORK_ITEMS; n++)
+ try
+ {
+ for(size_t n = 0; n < WORK_ITEMS; n++)
+ {
+ workitems.emplace_back(&shared_state);
+ shared_state.h.write(n * IO_SIZE, {{buffer, sizeof(buffer)}}).value();
+ }
+ }
+ catch(const std::runtime_error &e)
{
- workitems.emplace_back(&shared_state);
- shared_state.h.write(n * IO_SIZE, {{buffer, sizeof(buffer)}}).value();
+ std::cout << "\nNOTE: Received exception '" << e.what()
+ << "' when trying to construct dynamic_thread_pool_group::io_aware_work_item, assuming this platform does not implement statfs::f_iosinprogress "
+ "and skipping test."
+ << std::endl;
+ return;
}
auto tpg = llfio::make_dynamic_thread_pool_group().value();
tpg->submit(llfio::span<work_item>(workitems)).value();
@@ -446,5 +475,5 @@ KERNELTEST_TEST_KERNEL(integration, llfio, dynamic_thread_pool_group, works, "Te
TestDynamicThreadPoolGroupWorks())
KERNELTEST_TEST_KERNEL(integration, llfio, dynamic_thread_pool_group, nested, "Tests that nesting of llfio::dynamic_thread_pool_group works as expected",
TestDynamicThreadPoolGroupNestingWorks())
-// KERNELTEST_TEST_KERNEL(integration, llfio, dynamic_thread_pool_group, io_aware_work_item,
-// "Tests that llfio::dynamic_thread_pool_group::io_aware_work_item works as expected", TestDynamicThreadPoolGroupIoAwareWorks())
+KERNELTEST_TEST_KERNEL(integration, llfio, dynamic_thread_pool_group, io_aware_work_item,
+ "Tests that llfio::dynamic_thread_pool_group::io_aware_work_item works as expected", TestDynamicThreadPoolGroupIoAwareWorks())