From: Yedidya Feldblum Date: Tue, 4 Jul 2017 02:41:36 +0000 (-0700) Subject: Apply clang-format to folly/concurrency/ X-Git-Tag: v2017.07.10.00~13 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d34ef77fc9d4bc810da415387099d37493fd2562;p=folly.git Apply clang-format to folly/concurrency/ Summary: [Folly] Apply `clang-format` to `folly/concurrency/`. Reviewed By: Orvid Differential Revision: D5366946 fbshipit-source-id: 2c9de7c4d8534e02c367fd235fb1ea943ba0539e --- diff --git a/folly/concurrency/CacheLocality.cpp b/folly/concurrency/CacheLocality.cpp index 36b77b83..bb465d46 100644 --- a/folly/concurrency/CacheLocality.cpp +++ b/folly/concurrency/CacheLocality.cpp @@ -146,27 +146,25 @@ CacheLocality CacheLocality::readFromSysfsTree( throw std::runtime_error("unable to load cache sharing info"); } - std::sort(cpus.begin(), - cpus.end(), - [&](size_t lhs, size_t rhs) -> bool { - // sort first by equiv class of cache with highest index, - // direction doesn't matter. If different cpus have - // different numbers of caches then this code might produce - // a sub-optimal ordering, but it won't crash - auto& lhsEquiv = equivClassesByCpu[lhs]; - auto& rhsEquiv = equivClassesByCpu[rhs]; - for (ssize_t i = ssize_t(std::min(lhsEquiv.size(), rhsEquiv.size())) - 1; - i >= 0; - --i) { - auto idx = size_t(i); - if (lhsEquiv[idx] != rhsEquiv[idx]) { - return lhsEquiv[idx] < rhsEquiv[idx]; - } - } - - // break ties deterministically by cpu - return lhs < rhs; - }); + std::sort(cpus.begin(), cpus.end(), [&](size_t lhs, size_t rhs) -> bool { + // sort first by equiv class of cache with highest index, + // direction doesn't matter. If different cpus have + // different numbers of caches then this code might produce + // a sub-optimal ordering, but it won't crash + auto& lhsEquiv = equivClassesByCpu[lhs]; + auto& rhsEquiv = equivClassesByCpu[rhs]; + for (ssize_t i = ssize_t(std::min(lhsEquiv.size(), rhsEquiv.size())) - 1; + i >= 0; + --i) { + auto idx = size_t(i); + if (lhsEquiv[idx] != rhsEquiv[idx]) { + return lhsEquiv[idx] < rhsEquiv[idx]; + } + } + + // break ties deterministically by cpu + return lhs < rhs; + }); // the cpus are now sorted by locality, with neighboring entries closer // to each other than entries that are far away. For striping we want diff --git a/folly/concurrency/CacheLocality.h b/folly/concurrency/CacheLocality.h index be9d4410..f2a39179 100644 --- a/folly/concurrency/CacheLocality.h +++ b/folly/concurrency/CacheLocality.h @@ -58,7 +58,6 @@ namespace folly { // perfect L1 spreading in a system with hyperthreading enabled. struct CacheLocality { - /// 1 more than the maximum value that can be returned from sched_getcpu /// or getcpu. This is the number of hardware thread contexts provided /// by the processors @@ -152,7 +151,6 @@ struct Getcpu { #ifdef FOLLY_TLS template