1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-13 03:42:24 +03:00
Commit Graph

11 Commits

Author SHA1 Message Date
Victor Zverovich
da70fce0d3 Replace Folly Format with fmt in logger to reduce binary size
Summary:
Now that fmt is available in Folly builds (D14813810), use it to reduce binary code size in Folly Logger. This is done by moving most of the formatting logic behind the type-erased `vformat` API. Previously it was instantiated for all combinations of formatting argument types used in calls to `FB_LOGF` and `XLOGF` in a program.

The effect of this change can be illustrated by looking at symbol sizes as given by `nm -S -td` for the following test function:

```
void test_log() {
  FB_LOGF(logger, WARN, "num events: {:06d}, duration: {:6.3f}", 1234, 5.6789);
}
```
compiled in `opt` mode.

`nm` before:

```
0000000004236736 0000000000000231 T test_log()
0000000004236992 0000000000001002 W std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > folly::LogStreamProcessor::formatLogString<int, double>(folly::Range<char const*>, int const&, double const&)
```

`nm` after:

```
0000000004237536 0000000000000231 T test_log()
0000000004237792 0000000000000251 W std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > folly::LogStreamProcessor::formatLogString<int, double>(folly::Range<char const*>, int const&, double const&)
0000000004238048 0000000000000740 W folly::LogStreamProcessor::vformatLogString[abi:cxx11](folly::Range<char const*>, fmt::v5::format_args, bool&)
```

Before we had one 1002 byte instantiation of `formatLogString<int, double>`. With this change it was reduced 4x to 251 bytes and non-template function `vformatLogString` was added which is shared among all logging calls. The size of `test_log` remained unchanged. There are even bigger savings from Folly Formatter instantiations which are no longer needed, e.g.

```
0000000004238032 0000000000001363 W _ZNK5folly13BaseFormatterINS_9FormatterILb0EJRKiRKdEEELb0EJS3_S5_EEclIZNKS7_8appendToINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEENSt9enable_ifIXsr12IsSomeStringIT_EE5valueEvE4typeERSH_EUlNS_5RangeIPKcEEE_EEvSK_
```

So in total this change results in ~5x per-call/instantiation binary size. It is possible to reduce binary size even further but it is not done in the current diff to keep it manageable.

In addition to binary size improvements, switching to fmt will potentially

* allow catching errors in format strings at compile time,
* simplify future migration to C++20 [`std::format`](http://eel.is/c++draft/format).

Reviewed By: simpkins

Differential Revision: D15485589

fbshipit-source-id: 06db4436839f11c2c3dbed7b36658e2193343411
2019-11-18 05:52:41 -08:00
Adam Simpkins
abab97ce33 fbcode_builder: update the old fbcode_builder spec for fbzmq
Summary:
The external Travis CI builds for fbzmq are still using the older
fbcode_builder spec (as opposed to the newer getdeps manifest file).

D16577367 moved the CMakeLists.txt file to the top-level directory, but the
fbzmq spec file was still looking for it in the fbzmq subdirectory.

Reviewed By: jstrizich

Differential Revision: D17005361

fbshipit-source-id: 3f7664eadfb60ec7606124a14445b44ae586b8a7
2019-08-26 11:46:16 -07:00
Jingyi Yang
fef1c99c56 add fiber support
Summary: This diff allows zmq socket to run on folly::fibers

Reviewed By: saifhhasan

Differential Revision: D15113447

fbshipit-source-id: 8a0e1f91d719a9deda48837d4ff1065408280b72
2019-06-10 08:45:53 -07:00
Cen Zhao
c4cdad4b30 add handshake events handling
Summary: zmq4.3 bring up 4 more handshake events, add proper handling in sock monitor

Reviewed By: saifhhasan

Differential Revision: D15058676

fbshipit-source-id: d2553c7e32471a2403857741cbb77a40e50d353e
2019-04-25 15:51:54 -07:00
Yunus Rahbar
e3b1c3b50d Add copyright headers to fbcode builder source files
Reviewed By: simpkins

Differential Revision: D12990230

fbshipit-source-id: 58d82299a8fe6aed75115008fe5dfb0f46d847c6
2018-11-09 09:52:15 -08:00
Mahesh Maddikayala
0bc6d7c294 Add resource monitor object to fbzmq library
Summary:
Add resource monitor object to fbzmq library to monitor CPU and memory. User can use
the object to query RSS memory, cpu usage, and optionally call API to monitor memory periodicially
 and crash when reaches beyond a specified threshold limit.

Reviewed By: cenzhao

Differential Revision: D8873504

fbshipit-source-id: a445fdd580da82c55fba09c43f46f60bb9f1149a
2018-07-23 10:42:37 -07:00
Alex Guzman
0d6760a1d2 Pull sodium fbcode_builder spec out
Summary: Makes a spec for libsodium.

Reviewed By: knekritz

Differential Revision: D8228801

fbshipit-source-id: 18f623bce0bbc07f711129b15b78d56b6c852bf7
2018-06-12 11:57:40 -07:00
Saif Hasan
8e83be0717 fix build
Summary:
fbthrift generate errorneous code when cpp type IOBuf pointer is used. Let's use
IOBuf object instead as it is cheap to copy construct and underlying buffer is
anyway shared when objects are copied.

Reviewed By: plapukhov

Differential Revision: D8130040

fbshipit-source-id: 3c109a85951054fed890707f56170b46cfefc917
2018-05-23 19:02:11 -07:00
John Strizich
19368dbb89 update org for fbcode builder
Summary: needed to update this here as well

Reviewed By: plapukhov

Differential Revision: D5986326

fbshipit-source-id: 4913eb1b3d5521d08b65dcdb4696f42d86269c3e
2017-10-05 11:01:00 -07:00
John Strizich
3a6ea15009 fix libsodium build
Summary: modifying some builds.

Reviewed By: plapukhov, eduardo-elizondo

Differential Revision: D5898592

fbshipit-source-id: cb9bbac598a5ccab283f2c18f29a1065592de3eb
2017-09-24 20:39:55 -07:00
John Strizich
d613fed62f trying out this tool, fbcodeBuilder
Summary:
this diff provides ci builds for our two open source projects, openr and fbzmq, by leveraging snarkmaster 's awesome tool, fbcode builder. this will run our external cmake build process on lego-linux sandcastle boxes and also generates scripts for building on travis with docker externally.

this diff is modeled on D4441467. it also includes some changes to fbcode builder itself and some minor changes in our cmake files.

snarkmaster , please take a look at my fbcode builder changes. I needed to make some modifications in order to build some of our dependencies which have slightly non-standard build steps and to run tests. I split up the configure step, and I addressed an issue around workdir with cmake. the last workdir was just a relative path, `build`, so it was hard to get back to it in a future step to run tests.

Reviewed By: saifhhasan

Differential Revision: D5141184

fbshipit-source-id: 94cacab807a3a0da4d0d81016d7f36f37656145d
2017-06-09 22:40:36 -07:00