Skip to content

Commit

Permalink
Patch svn r35218
Browse files Browse the repository at this point in the history
  • Loading branch information
gejun committed Sep 4, 2017
1 parent a4a7cdf commit 24c64ea
Show file tree
Hide file tree
Showing 119 changed files with 855 additions and 334 deletions.
18 changes: 14 additions & 4 deletions src/base/arena.cpp
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

Expand Down
26 changes: 19 additions & 7 deletions src/base/arena.h
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"
Expand Down Expand Up @@ -68,4 +80,4 @@ inline void* Arena::allocate(size_t n) {

} // namespace base

#endif // BRPC_BASE_ARENA_H
#endif // BAIDU_BASE_ARENA_H
23 changes: 18 additions & 5 deletions src/base/bit_array.h
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

Expand Down
18 changes: 14 additions & 4 deletions src/base/class_name.cpp
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

Expand Down
28 changes: 20 additions & 8 deletions src/base/class_name.h
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
Expand Down Expand Up @@ -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
18 changes: 14 additions & 4 deletions src/base/comlog_sink.cc
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

Expand Down
20 changes: 16 additions & 4 deletions src/base/comlog_sink.h
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

Expand Down
22 changes: 17 additions & 5 deletions src/base/containers/bounded_queue.h
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
Expand Down
17 changes: 14 additions & 3 deletions src/base/containers/case_ignored_flat_map.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
// Baidu RPC - A framework to host and access services throughout Baidu.
// Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved
// 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
//
// 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: The baidu-rpc authors (pbrpc@baidu.com)
// Author: Ge,Jun (gejun@baidu.com)
// Date: Sun Dec 4 14:57:27 CST 2016

namespace base {
Expand Down
17 changes: 14 additions & 3 deletions src/base/containers/case_ignored_flat_map.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
// Baidu RPC - A framework to host and access services throughout Baidu.
// Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved
// 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
//
// 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: The baidu-rpc authors (pbrpc@baidu.com)
// Author: Ge,Jun (gejun@baidu.com)
// Date: Sun Dec 4 14:57:27 CST 2016

#ifndef BASE_CASE_IGNORED_FLAT_MAP_H
Expand Down
15 changes: 13 additions & 2 deletions src/base/containers/doubly_buffered_data.h
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
Expand Down
22 changes: 17 additions & 5 deletions src/base/containers/flat_map.h
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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 14 additions & 4 deletions src/base/containers/flat_map_inl.h
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

Expand Down
20 changes: 16 additions & 4 deletions src/base/containers/pooled_map.h
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
Expand All @@ -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.
Expand Down
Loading

0 comments on commit 24c64ea

Please sign in to comment.