- 27 Jun, 2014 4 commits
-
-
Hans Fugal authored
Summary: The word "continuation" is too ambiguous. Prefer callback (except where we are actually talking about CSP continuations in the README). Test Plan: Still builds. Nothing external is or should be calling `setContinuation`. But I'll wait for contbuild anyway. Reviewed By: hannesr@fb.com Subscribers: net-systems@, fugalh, exa FB internal diff: D1406753 Tasks: 4480567
-
Hans Fugal authored
Summary: Removing this crufty API. The only callsite for `executeWith` was `Later::via` so I just folded it in there. Test Plan: unit tests contbuild Reviewed By: hannesr@fb.com Subscribers: net-systems@, fugalh, exa FB internal diff: D1406592 Tasks: 4480567
-
Hans Fugal authored
Summary: I have no idea why the compiler is gettings its britches in a bunch because a unit test has a predictable output. Really, gcc?! But whatever, avoiding inlining by putting it in the cpp file solves it. Test Plan: fbmake runtests_opt Reviewed By: davejwatson@fb.com Subscribers: net-systems@, fugalh, exa FB internal diff: D1405811 Tasks: 4591823
-
Hans Fugal authored
Summary: Add the `QueuedImmediateExecutor` which behaves like `InlineExecutor` but with different (and usually better) ordering semantics for nested calls. @override-unit-failures Test Plan: unit tests Reviewed By: davejwatson@fb.com Subscribers: folly@lists, net-systems@, fugalh, exa FB internal diff: D1364904 Tasks: 3789661
-
- 26 Jun, 2014 10 commits
-
-
Tudor Bosman authored
Reviewed By: meyering@fb.com Test Plan: no
-
Tudor Bosman authored
Summary: Also, optionalize dependencies on compression libraries. Test Plan: fbconfig -r folly && fbmake runtests_opt Reviewed By: meyering@fb.com Subscribers: kma, jhj, simpkins, lesha, folly@lists FB internal diff: D1396573
-
Anton Likhtarov authored
Summary: On 12.04, there's both /usr/lib/libiberty.a and /usr/lib/libiberty_pic.a, and _pic is the one we want to build a Folly shared library. Test Plan: build on Ubuntu 12.04 Reviewed By: meyering@fb.com FB internal diff: D1402194
-
Hans Fugal authored
Summary: and ManualExecutor implementation Test Plan: unit tests, contbuild Reviewed By: davejwatson@fb.com Subscribers: bmatheny, folly@lists, net-systems@, fugalh, exa, marccelani, jsedgwick FB internal diff: D1392999 Tasks: 4548494
-
Tudor Bosman authored
Summary: Also, optionalize dependencies on compression libraries. Test Plan: fbconfig -r folly && fbmake runtests_opt Reviewed By: meyering@fb.com Subscribers: kma, jhj, simpkins, lesha, folly@lists FB internal diff: D1396573
-
Tudor Bosman authored
Summary: Because @lesha asked "why not" and I couldn't give him an answer. Test Plan: random_test Reviewed By: bmaurer@fb.com Subscribers: bmaurer, folly@lists, jhj, kma, lesha, sdoroshenko, soren FB internal diff: D1394401
-
Peter Ruibal authored
Summary: fbthrift depends on <folly/ThreadName.h>, which isn't currently getting installed as part of the autotools build. Add it to Makefile.am Test Plan: Made this change to folly, re-autogen/configure/install, and then was able to successfully compile fbthrift's compiler Reviewed By: davejwatson@fb.com Subscribers: doug, folly@lists FB internal diff: D1397084
-
Yunqi Zhang authored
Summary: This diff allows users to loop through EventBase without blocking if there are not any events to process. This is useful for sending and receiving requests on network, where users just want to try if there are any events and do not want to block if not. https://phabricator.fb.com/D1373887 is an example where we find this feature useful, otherwise we have to add an empty callback before loop. event_base_.runInLoop([] {}); event_base_.loopOnce(); @davejwatson, @fugalh, @simpkins, @stepan: Could you please take a look at the proposed changes and let me know if there is any better ways of doing this. Thank you! Test Plan: I think this would not break anything, but we might want to do some performance profiling if needed. Reviewed By: hans@fb.com Subscribers: simpkins, davejwatson, fugalh, stepan, folly@lists FB internal diff: D1383401
-
Nicholas Ormrod authored
Summary: Some libgcc-incompatible code has been added to fbstring. Removed/reorganized it so that we can drop fbstring right into libgcc. Test Plan: fbconfig -r folly && fbmake runtests Copied FBString.h into libgcc's basic_fbstring.h, with no modifications. Successfully tp2_build libgcc/4.8.1. Adjusted symlink, then fbmake clean && fbconfig -r folly && fbmake dbg. The fbmake dbg failed with an assertion error, which is consistent with @lucian's observations in D1373725; the important part is that the error was at runtime, so the compile-time changes of this diff looks good. Reviewed By: lucian@fb.com Subscribers: folly@lists, sdwilsh, njormrod, lucian FB internal diff: D1382873
-
Nicholas Ormrod authored
Summary: Now that fbstring is conservative by default (D1373308), we can remove the mutability of the data members and the call to c_str() in operator[]. Test Plan: fbconfig -r folly && fbmake runtests Reviewed By: lucian@fb.com Subscribers: folly@lists, sdwilsh, njormrod FB internal diff: D1382644
-
- 14 Jun, 2014 5 commits
-
-
Anton Likhtarov authored
Test Plan: build it Reviewed By: pavlo@fb.com Subscribers: folly@lists FB internal diff: D1383722
-
Lucian Grijincu authored
Test Plan: ran folly tests Reviewed By: njormrod@fb.com Subscribers: folly@lists, njormrod FB internal diff: D1373308
-
Nicholas Ormrod authored
Summary: @lucian's D1373308 set fbstring to conservative by default. This breaks, eg, ti/proxygen/httpclient tests, by failing an assertion inside of c_str(). Specifically, the terminator is not '\0'. The fbstring_core move constructor, when sourced by a MediumLarge string, steals the source's internal data, then resets the source by calling ##setSmallSize(0)##. That function sets the in-situ size of the fbstring to zero, thus requalifying the string as a small string; however, it does nothing to the data - the previous 23 bytes now contain garbage. Sources of a move must be in a consistent state after the move is complete. The source, once a MediumLarge string whose first eight bytes were a pointer, is now a small string of size zero whose first byte is not necessarily '\0'. This breaks the FBSTRING_CONSERVATIVE invariant. This can be fixed by writing a terminator after the setSmallSize call. I have fixed all setSmallSize locations that do not writeTerminator. fbstring_core's move constructor is called exclusively from basic_fbstring's move assignment operator, hence the odd format of the test case. == TMI == Interestingly, the source will almost certainly* contain a '\0', which prevents this simple ##str.size() != strlen(str.c_str())## bug from turning into a memory-trampling monster. The new size of zero is not what saves us - the 'size' byte of a small fbstring, through a very clever trick to allow 23-byte in-situ strings, is actually 23 minus the actual size (now 0), so is 23! Where, then, does the '\0' byte come? A MediumLarge string's data layout is [pointer, size, capacity]. The pointer is not guaranteed to contain a '\0', and neither are size or capacity. However, the size of the string needs to be very large in order to force the top byte of the size member to be non-zero; in that case, the string is so large that malloc is returning memory by the page. Since page sizes are a multiple of 2^8 (almost always, and if not then I don't think your fbstring can support large enough sizes anyways), and we use goodMallocSize, the capacity pointer would have a least signfigicant byte of zero. Why the (*)? Well, when reserving extra space on a non-refcounted Large string, the reallocation does not yield its extra goodMallocSize space. This could be fixed, though probably isn't worth the trouble. Anyways, since we aren't goodMallocSize-ing the user-supplied requested capacity, it probably won't contain a '\0'. Test Plan: fbconfig -r folly && fbmake runtests Modify folly/test/FBStringTest.cpp to define FBSTRING_CONSERVATIVE, then fbconfig folly/test/:fbstring_test_using_jemalloc && fbmake runtests Note that this fails before the patch is applied. Note that it is possible for the tests to pass even when this bug is present, since the top byte of the heap pointer must be non-0 in order for this error to be triggered. Reviewed By: lucian@fb.com Subscribers: folly@lists, njormrod, lucian, markisaa, robbert, sdwilsh, tudorb, jdelong FB internal diff: D1376517
-
Nicholas Ormrod authored
Summary: Some asserts could be static_asserts. Make it so! Test Plan: fbconfig -r folly && fbmke opt && fbmake runtests_opt Reviewed By: lucian@fb.com Subscribers: folly@lists, sdwilsh, njormrod FB internal diff: D1378670
-
Vojin Katic authored
Summary: I made it work, but please send your feedback how to improve code quality. splitByLine will split on \r, \n, and \r\n. Test Plan: add new test, arc unit Reviewed By: tjackson@fb.com Subscribers: folly@lists, crawler-diffs@ FB internal diff: D1322212
-
- 09 Jun, 2014 19 commits
-
-
Jim Meyering authored
Summary: Without this, we'd see problems like this in tao, when building with clang: With this change, this now works with clang-3.4 and clang.dev (3.4+). This change reverts D950285, which change appears to have been made to accommodate weakness in clang-3.3 or older. In file included from tao/data_providers/common/simpledp.cpp:7: ./tao/data_providers/common/stats.h:175:18: error: no type named 'RWTicketSpinLockT' in namespace 'folly' typedef folly::RWTicketSpinLockT<64, true> RWLockType; ~~~~~~~^ ./tao/data_providers/common/stats.h:175:35: error: expected member name or ';' after declaration specifiers typedef folly::RWTicketSpinLockT<64, true> RWLockType; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ Test Plan: ensure that all of these pass: fbconfig -r --clang folly/test:rw_spinlock_test && fbmake runtests fbconfig -r --clang folly/test:rw_spinlock_test && fbmake runtests_opt fbconfig -r folly/test:rw_spinlock_test && fbmake runtests_opt fbconfig -r --clang --with-project-version clang:dev \ folly/test:rw_spinlock_test && fbmake runtests_opt Reviewed By: delong.j@fb.com Subscribers: folly@lists, mathieubaudet FB internal diff: D1370024 Tasks: 4090011
-
Zejun Wu authored
Summary: Avoid copying underlying char array in to<string>(const string&) and to<fbstring>(const fbstring&). Test Plan: fbconfig -r $redteamisthebestteam/$nekomikoreimu && fbmake Reviewed By: ldbrandy@fb.com Subscribers: jonp, folly@lists FB internal diff: D1368183 Tasks: 4263125
-
Marcus Holland-Moritz authored
Summary: I'm looping through a large number of test cases in a benchmark and I'm interested in the average time per test case rather than the total time, which is what I'm currently seeing. In order to get the average time, I need to be able to tell the benchmark module how many iterations have been run. This change adds _MULTI variants of the different BENCHMARK_ macros that allow for returning the actual number of iterations that have been run, e.g.: BENCHMARK_MULTI(benchmarkSomething) { std::vector<int> testCases { 0, 1, 1, 2, 3, 5 }; for (int c : testCases) { doSomething(c); } return testCases.size(); } Test Plan: * fbconfig -r folly && fbmake runtests * added new test cases to example benchmark code Reviewed By: simpkins@fb.com Subscribers: folly@lists, london_search@ FB internal diff: D1356437
-
Philip Pronin authored
Summary: D1318048#21 @override-unit-failures Test Plan: fbconfig -r folly && fbmake runtests_opt -j32 Reviewed By: njormrod@fb.com Subscribers: folly@lists, njormrod FB internal diff: D1368939 Tasks: 4466412 Blame Revision: D1318048
-
Stepan Palamarchuk authored
Summary: This change allows users to track lifetime of EventBase and perform clean shutdown when EventBase gets destructed. It is useful for users that rely on EventBase lifetime, but don't have any feedback mechanism with the owner of EventBase. For instance some part of code might remain running in background on the EventBase after the main object was destroyed (e.g. it might be finalizing some async requests). In such case the original owner doesn't know that there's something still running and may try to destroy EventBase. In that case such background code will remain zombie forever. AsyncMcClient changes are presented just as an example of usage. @davejwatson, @simpkins: Could you please take a look at the proposed changes for the EventBase? If this is something not worth adding into EventBase, could you recommend a better way of doing things? Test Plan: fbmake runtests Reviewed By: alikhtarov@fb.com Subscribers: folly@lists, simpkins, davejwatson FB internal diff: D1353101
-
Marcelo Juchem authored
Summary: more flexibility for using functors with split_step Test Plan: unit tests added + arc unit Reviewed By: ldbrandy@fb.com Subscribers: folly@lists FB internal diff: D1362644
-
Tudor Bosman authored
Test Plan: test added Reviewed By: davejwatson@fb.com Subscribers: folly@lists FB internal diff: D1359469
-
Matt Dordal authored
Summary: It might be useful to be able to wait for some time (but not forever) on a future, so this is a shot at doing that. It's a very heavyweight implementation, however. Since the current interface for waitWithSemaphore doesn't really make sense if the timeout fires, change it to return a Future<T>. Test Plan: unit tests Reviewed By: hans@fb.com Subscribers: trunkagent, folly@lists, fugalh FB internal diff: D1358230
-
Jon Purdy authored
Summary: C++14 adds this overload but I wanted it today. Test Plan: It compiles, and this is the definition described in the standard. Reviewed By: xning@fb.com Subscribers: folly@lists FB internal diff: D1338839
-
Philip Pronin authored
Summary: Accidentally spotted this problem. `folly/FileUtil.h` and `common/files/FileUtil.h` are now using `*NoInt` wrappers where appropriate. Test Plan: fbconfig -r common/files folly && fbmake opt -j32 Reviewed By: lucian@fb.com Subscribers: folly@lists, fbcode-common-diffs@lists FB internal diff: D1356261
-
Tom Jackson authored
Summary: I was confused by it, thought rephrasing might help. Test Plan: Read Reviewed By: tudorb@fb.com Subscribers: folly@lists FB internal diff: D1315612
-
Dave Watson authored
Summary: Currently notification queue does 2 syscalls per item: one read, one write. We only need the eventfd to notify to wake up the thread, so instead, if the thread is already awake, don't bother writing to the fd. Benchmark shows that when the queue size() > 1, this is ~4x faster. Note that this might be unfair if there are multiple consumers: I could imagine a situation where one thread eats all the wakeups written to the fd, so only one thread is actually working. However, multiple consumers is a bad idea anyway, and I'd consider removing it entirely: If the same fd is in multiple epoll() loops, _all_ epolls will wake up, resulting in a thundering herd problem. I don't see any multiConsumer cases in fbcode Using EFD_SEMAPHORE or not doesn't seem to matter, since hopefully we're only writing 1 wakeup per thread - and it wouldn't work at all for multiConsumer case. Test Plan: fbconfig thrift/lib/cpp/test:TNotificationQueueTest; fbamke runtests fbconfig common/concurrency:QueueBenchmark fbmake opt QueueBenchmark --bm_min_iters=10000 Reviewed By: afrind@fb.com Subscribers: doug, folly@lists, fbcode-common-diffs@lists, alandau, bmatheny, haijunz FB internal diff: D1272872 Tasks: 2802758
-
Jim Meyering authored
Summary: This code fails to compile with clang:dev, so don't try for now. * folly/wangle/test/Thens.cpp: Don't attempt to compile test/Thens.cpp. See 4412111 for details. Prompted by clang:dev+MSAN effort, 4090011. Test Plan: Run this: fbconfig --clang --with-project-version clang:dev -r folly/wangle fbmake runtests Failed before, passes with this patch. Reviewed By: hans@fb.com Subscribers: folly@lists, fugalh FB internal diff: D1354751 Tasks: 4090011, 4412111
-
Yedidya Feldblum authored
Summary: [Folly] Add shorthand functions to Format.h. This makes calling code simpler when it does not depend on the raw performance of writing to a stream. Test Plan: $ fbconfig -r folly/test $ fbmake runtests Reviewed By: tudorb@fb.com Subscribers: folly@lists, dougw FB internal diff: D1347353 Tasks: 4391110
-
Matt Dordal authored
Summary: waitWithSemaphore currently doesn't support vector<Try<T>>, unless T is void. Fix that, and also add a now-required void specialization. Test Plan: Add a test that uses vector<Try<bool>>, ensure that the tests compile (and pass). Reviewed By: hans@fb.com Subscribers: folly@lists, fugalh FB internal diff: D1338528 Tasks: 4389473
-
Simon Martin authored
Summary: Added a test to call Future::value() before the Promise value is set, expecting an exception. In a dbg build the test failed due on the assertion in Optional::value(). In a opt build the test failed due as no exception was thrown. There are 2 points where we could throw our exception: a) Optional::value() - replacing the assertion b) Future::value() I'm not sure which location makes the most sense. With the assertion in Optional it seems that adding the throw here would not be unexpected but this is outside the wangle code. So as a first pass I've added the throw in Future::value(), and made a new WangleException for this. Test Plan: $ fbconfig folly/wangle $ fbmake runtests Reviewed By: hans@fb.com Subscribers: folly@lists, fugalh FB internal diff: D1340886
-
Daniil Burdakov authored
Summary: subj Test Plan: unit tests Reviewed By: tjackson@fb.com Subscribers: folly@lists FB internal diff: D1341693
-
Tudor Bosman authored
Summary: - libtool version - get rid of tiny libraries - add folly/gen and a bunch of stuff from experimental Test Plan: built, built a program against it in a ubuntu vm Reviewed By: davejwatson@fb.com Subscribers: folly@lists, fugalh FB internal diff: D1339920
-
Adam Simpkins authored
Summary: Previously BucketedTimeSeries()::addValue() documented that it required time to move forwards. If it was ever called with a timestamp older than the most recent one it had seen, it would just use latestTime_ as the time, and add the value to the most recent bucket. This changes addValue() so that it always uses the timestamp passed in by the caller. If this time value refers to an old bucket that is still being tracked, the data point will be added to that bucket. If the time value is older than the oldest currently tracked bucket, the data point will be ignored, and false will be returned. I did consider leaving the current addValue() behavior as-is, and requiring a separate addHistoricalValue() for when users intentionally want to try adding old data points. However, it seems nicer to build this into the existing addValue() function. The old behavior of just replacing the supplied time value seems potentially surprising to users. This does change the behavior of addValue(), and therefore could affect the behavior of some programs. However, up until now no-one should have been calling addValue() with old time values, as it wouldn't have done what they want anyway. I did a brief search through our code base, and all call sites I saw always called addValue() with the current time. (Most of the callers use wall clock time, so this change might affect program behavior if the system time changes after the program starts. We should ideally change our programs to use monotonic clocks instead.) Test Plan: Included a new unit test. Also compared the timeseries_benchmark results before and after this change. Overall this new logic seems to be faster. For the "all time" case, the new code is over 2x as fast. For the normal, non-all-time case the new code is around 5% faster. Reviewed By: hans@fb.com Subscribers: doug, folly@lists, net-systems@, exa FB internal diff: D1338466
-
- 20 May, 2014 2 commits
-
-
Tudor Bosman authored
Summary: - switch to new versions of ax_boost_*.m4 - versioning in libtool - better checks in configure.ac Test Plan: built in an Ubuntu VM Reviewed By: davejwatson@fb.com Subscribers: folly@lists FB internal diff: D1338957
-
Tudor Bosman authored
Summary: So it doesn't interleave with whatever other threads write to stderr. Test Plan: folly/experimental/symbolizer/test Reviewed By: lucian@fb.com Subscribers: folly@lists FB internal diff: D1337029
-