We now truncate the buffer to the appropriate length when clients call stats_event_build(). Benchmarking tests indicate that truncating the buffer to the appropriate length increases the cost clients pay to write to the socket by 2%. This is negligible enough that I decided to truncate the buffer for both pushed and pulled atoms in order to simplify the API. Test: m libstatssocket Test: bit libstatssocket_benchmark:* Bug: 144126231 Change-Id: I35dec748ff87c0821d0d06779a406997e6e64966 Merged-In: Ife976bb383ecff8de5064730692a95e2a3a82c9d
19 lines
673 B
C++
19 lines
673 B
C++
/*
|
|
* Copyright (C) 2019 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#include <benchmark/benchmark.h>
|
|
|
|
BENCHMARK_MAIN();
|