37 f = open(
'%s/../test/speed_test.cpp' % (os.path.dirname(__file__)),
'w')
39 f.write(
"// !!!!!!!!!!!!!!!!!!!!!!! This is a generated file, do not edit manually\n\n")
42 f.write(
' * Copyright (c) 2008, Willow Garage, Inc.\n')
43 f.write(
' * All rights reserved.\n')
45 f.write(
' * Redistribution and use in source and binary forms, with or without\n')
46 f.write(
' * modification, are permitted provided that the following conditions are met:\n')
48 f.write(
' * * Redistributions of source code must retain the above copyright\n')
49 f.write(
' * notice, this list of conditions and the following disclaimer.\n')
50 f.write(
' * * Redistributions in binary form must reproduce the above copyright\n')
51 f.write(
' * notice, this list of conditions and the following disclaimer in the\n')
52 f.write(
' * documentation and/or other materials provided with the distribution.\n')
53 f.write(
' * * Neither the name of Willow Garage, Inc. nor the names of its\n')
54 f.write(
' * contributors may be used to endorse or promote products derived from\n')
55 f.write(
' * this software without specific prior written permission.\n')
57 f.write(
' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\n')
58 f.write(
' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n')
59 f.write(
' * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n')
60 f.write(
' * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n')
61 f.write(
' * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n')
62 f.write(
' * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n')
63 f.write(
' * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n')
64 f.write(
' * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n')
65 f.write(
' * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n')
66 f.write(
' * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n')
67 f.write(
' * POSSIBILITY OF SUCH DAMAGE.\n')
70 f.write(
'#include "ros/console.h"\n')
71 f.write(
'#include "log4cxx/appenderskeleton.h"\n')
80 f.write(
'class NullAppender : public log4cxx::AppenderSkeleton {\n')
81 f.write(
'protected:\n')
82 f.write(
'virtual void append(const log4cxx::spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool){printf("blah\\n");}\n')
83 f.write(
'virtual void close() {}\n')
84 f.write(
'virtual bool requiresLayout() const { return false; } };\n')
86 f.write(
'int main(int argc, char** argv)\n{\n')
87 f.write(
'ROSCONSOLE_AUTOINIT; \nlog4cxx::Logger::getLogger(ROSCONSOLE_ROOT_LOGGER_NAME)->removeAllAppenders();\n')
88 f.write(
'log4cxx::Logger::getLogger(ROSCONSOLE_DEFAULT_NAME)->addAppender(new NullAppender);\n')
89 f.write(
'log4cxx::Logger::getLogger(ROSCONSOLE_DEFAULT_NAME)->setLevel(log4cxx::Level::getFatal());\n')
90 f.write(
'for (int i = 0;i < %s; ++i)\n{\n' %(sys.argv[2]))
92 for i
in range(0,int(sys.argv[1])):
98 f.write(
'ROS_INFO("test");')
99 f.write(
'ROS_WARN("test");')
100 f.write(
'ROS_ERROR("test");')
101 f.write(
'ROS_DEBUG("test");')
102 f.write(
'ROS_ERROR("test");')