Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Support performance benchmarking using Google benchmark #606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
Loading
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add license
  • Loading branch information
stephen-webb committed Dec 19, 2023
commit 9094017e95d5fdb588ccea0620f8ab462af5a9df
24 changes: 20 additions & 4 deletions 24 tests/benchmark/benchmark.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 <log4cplus/logger.h>
#include <log4cplus/loggingmacros.h>
#include <log4cplus/layout.h>
Expand Down Expand Up @@ -38,7 +54,7 @@ class benchmarker : public ::benchmark::Fixture
m_logger.setLogLevel(INFO_LOG_LEVEL);

SharedAppenderPtr nullWriter(new NullWriterAppender);
nullWriter->setName(LOG4CPLUS_TEXT("NullWriterAppender"));
nullWriter->setName(LOG4CPLUS_TEXT("NullWriterAppender"));
nullWriter->setLayout(std::make_unique<PatternLayout>(LOG4CPLUS_TEXT("%m%n")));
m_logger.addAppender(nullWriter);
}
Expand All @@ -59,17 +75,17 @@ class benchmarker : public ::benchmark::Fixture
int threadCount = -1;
auto value = std::getenv("LOG4CPLUS_BENCHMARK_THREAD_COUNT");
if (value)
threadCount = std::stoi(value);
threadCount = std::stoi(value);
if (threadCount <= 0)
threadCount = std::thread::hardware_concurrency() - 2;
return threadCount;
}

static double warmUpSeconds()
{
double milliseconds = 100;
double milliseconds = 100;
if (auto value = std::getenv("LOG4CPLUS_BENCHMARK_WARM_UP_MILLISECONDS"))
milliseconds = std::stoi(value);
milliseconds = std::stoi(value);
return milliseconds / 1000;
}

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.