forked from apache/brpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gejun
committed
Sep 4, 2017
1 parent
a4a7cdf
commit 24c64ea
Showing
119 changed files
with
855 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
// Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// Do small memory allocations on continuous blocks. | ||
// | ||
// Copyright (c) 2015 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Fri Jun 5 18:25:40 CST 2015 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
// Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// Do small memory allocations on continuous blocks. | ||
// | ||
// Copyright (c) 2015 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Fri Jun 5 18:25:40 CST 2015 | ||
|
||
#ifndef BRPC_BASE_ARENA_H | ||
#define BRPC_BASE_ARENA_H | ||
// Do small memory allocations on continuous blocks. | ||
|
||
#ifndef BAIDU_BASE_ARENA_H | ||
#define BAIDU_BASE_ARENA_H | ||
|
||
#include <stdint.h> | ||
#include "base/macros.h" | ||
|
@@ -68,4 +80,4 @@ inline void* Arena::allocate(size_t n) { | |
|
||
} // namespace base | ||
|
||
#endif // BRPC_BASE_ARENA_H | ||
#endif // BAIDU_BASE_ARENA_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
// Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// Copyright (c) 2014 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Tue Feb 25 23:43:39 CST 2014 | ||
|
||
// Provide functions to get/set bits of an integral array. These functions | ||
// are not threadsafe because operations on different bits may modify a same | ||
// integer. | ||
// | ||
// Author: Ge,Jun ([email protected]) | ||
// Date: Tue Feb 25 23:43:39 CST 2014 | ||
|
||
#ifndef BASE_BIT_ARRAY_H | ||
#define BASE_BIT_ARRAY_H | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
// Copyright (c) 2011 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// Implement class_name.h | ||
// | ||
// Copyright (c) 2011 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Mon. Nov 7 14:47:36 CST 2011 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
// Copyright (c) 2011 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// Get name of a class. For example, class_name<T>() returns the name of T | ||
// (with namespace prefixes). This is useful in template classes. | ||
// | ||
// Copyright (c) 2011 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Mon. Nov 7 14:47:36 CST 2011 | ||
|
||
#ifndef BRPC_BASE_CLASS_NAME_H | ||
#define BRPC_BASE_CLASS_NAME_H | ||
// Get name of a class. For example, class_name<T>() returns the name of T | ||
// (with namespace prefixes). This is useful in template classes. | ||
|
||
#ifndef BAIDU_BASE_CLASS_NAME_H | ||
#define BAIDU_BASE_CLASS_NAME_H | ||
|
||
#include <typeinfo> | ||
#include <string> // std::string | ||
|
@@ -42,4 +54,4 @@ template <typename T> std::string class_name_str(T const& obj) { | |
|
||
} // namespace base | ||
|
||
#endif // BRPC_BASE_CLASS_NAME_H | ||
#endif // BAIDU_BASE_CLASS_NAME_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
// Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// Redirect LOG() into comlog. | ||
// | ||
// Copyright (c) 2015 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Mon Jul 20 12:39:39 CST 2015 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
// Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// Redirect LOG() into comlog. | ||
// | ||
// Copyright (c) 2015 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Mon Jul 20 12:39:39 CST 2015 | ||
|
||
// Redirect LOG() into comlog. | ||
|
||
#ifndef BASE_COMLOG_SINK_H | ||
#define BASE_COMLOG_SINK_H | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
// Copyright (c) 2012 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// Copyright (c) 2012 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Sat Aug 18 12:42:16 CST 2012 | ||
|
||
// A thread-unsafe bounded queue(ring buffer). It can push/pop from both | ||
// sides and is more handy than thread-safe queues in single thread. Use | ||
// boost::lockfree::spsc_queue or boost::lockfree::queue in multi-threaded | ||
// scenarios. | ||
// | ||
// Author: Ge,Jun ([email protected]) | ||
// Date: Sat Aug 18 12:42:16 CST 2012 | ||
|
||
#ifndef BASE_BOUNDED_QUEUE_H | ||
#define BASE_BOUNDED_QUEUE_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
// Baidu RPC - A framework to host and access services throughout Baidu. | ||
// Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved | ||
// Copyright (c) 2014 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Mon Sep 22 22:23:13 CST 2014 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
// Copyright (c) 2013 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// Copyright (c) 2013 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Wed Nov 27 12:59:20 CST 2013 | ||
|
||
// This closed addressing hash-map puts first linked node in bucket array | ||
// directly to save an extra memory indirection. As a result, this map yields | ||
// close performance to raw array on nearly all operations, probably being the | ||
|
@@ -72,9 +87,6 @@ | |
// Seeking 100 from FlatMap/std::map/base::PooledMap/base::hash_map takes 3/55/53/14 | ||
// Seeking 1000 from FlatMap/std::map/base::PooledMap/base::hash_map takes 4/88/89/13 | ||
// Seeking 10000 from FlatMap/std::map/base::PooledMap/base::hash_map takes 4/177/185/14 | ||
// | ||
// Author: Ge,Jun ([email protected]) | ||
// Date: Wed Nov 27 12:59:20 CST 2013 | ||
|
||
#ifndef BASE_FLAT_MAP_H | ||
#define BASE_FLAT_MAP_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
// Copyright (c) 2013 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// Implement flat_map.h | ||
// Copyright (c) 2013 baidu-rpc authors. | ||
// | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Wed Nov 27 12:59:20 CST 2013 | ||
// | ||
|
||
#ifndef BASE_FLAT_MAP_INL_H | ||
#define BASE_FLAT_MAP_INL_H | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
// Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved | ||
// | ||
// A drop-in replacement for std::map to improve insert/erase performance slightly | ||
// Copyright (c) 2016 baidu-rpc authors. | ||
// | ||
// 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 | ||
// | ||
// Author: The baidu-rpc authors ([email protected]) | ||
// 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. | ||
|
||
// Author: Ge,Jun ([email protected]) | ||
// Date: Sat Dec 3 13:11:32 CST 2016 | ||
|
||
#ifndef BASE_POOLED_MAP_H | ||
|
@@ -17,6 +27,8 @@ namespace details { | |
template <class T1, size_t BLOCK_SIZE> class PooledAllocator; | ||
} | ||
|
||
// A drop-in replacement for std::map to improve insert/erase performance slightly | ||
// | ||
// When do use PooledMap? | ||
// A std::map with 10~100 elements. insert/erase performance will be slightly | ||
// improved. Performance of find() is unaffected. | ||
|
Oops, something went wrong.