Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 import os
00035 import sys
00036
00037 f = open('%s/../test/speed_test.cpp' % (os.path.dirname(__file__)), 'w')
00038
00039 f.write("// !!!!!!!!!!!!!!!!!!!!!!! This is a generated file, do not edit manually\n\n")
00040
00041 f.write('/*\n')
00042 f.write(' * Copyright (c) 2008, Willow Garage, Inc.\n')
00043 f.write(' * All rights reserved.\n')
00044 f.write(' *\n')
00045 f.write(' * Redistribution and use in source and binary forms, with or without\n')
00046 f.write(' * modification, are permitted provided that the following conditions are met:\n')
00047 f.write(' *\n')
00048 f.write(' * * Redistributions of source code must retain the above copyright\n')
00049 f.write(' * notice, this list of conditions and the following disclaimer.\n')
00050 f.write(' * * Redistributions in binary form must reproduce the above copyright\n')
00051 f.write(' * notice, this list of conditions and the following disclaimer in the\n')
00052 f.write(' * documentation and/or other materials provided with the distribution.\n')
00053 f.write(' * * Neither the name of Willow Garage, Inc. nor the names of its\n')
00054 f.write(' * contributors may be used to endorse or promote products derived from\n')
00055 f.write(' * this software without specific prior written permission.\n')
00056 f.write(' *\n')
00057 f.write(' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\n')
00058 f.write(' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n')
00059 f.write(' * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n')
00060 f.write(' * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n')
00061 f.write(' * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n')
00062 f.write(' * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n')
00063 f.write(' * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n')
00064 f.write(' * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n')
00065 f.write(' * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n')
00066 f.write(' * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n')
00067 f.write(' * POSSIBILITY OF SUCH DAMAGE.\n')
00068 f.write(' */\n\n')
00069
00070 f.write('#include "ros/console.h"\n')
00071 f.write('#include "log4cxx/appenderskeleton.h"\n')
00072
00073
00074
00075
00076
00077
00078
00079
00080 f.write('class NullAppender : public log4cxx::AppenderSkeleton {\n')
00081 f.write('protected:\n')
00082 f.write('virtual void append(const log4cxx::spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool){printf("blah\\n");}\n')
00083 f.write('virtual void close() {}\n')
00084 f.write('virtual bool requiresLayout() const { return false; } };\n')
00085
00086 f.write('int main(int argc, char** argv)\n{\n')
00087 f.write('ROSCONSOLE_AUTOINIT; \nlog4cxx::Logger::getLogger(ROSCONSOLE_ROOT_LOGGER_NAME)->removeAllAppenders();\n')
00088 f.write('log4cxx::Logger::getLogger(ROSCONSOLE_DEFAULT_NAME)->addAppender(new NullAppender);\n')
00089 f.write('log4cxx::Logger::getLogger(ROSCONSOLE_DEFAULT_NAME)->setLevel(log4cxx::Level::getFatal());\n')
00090 f.write('for (int i = 0;i < %s; ++i)\n{\n' %(sys.argv[2]))
00091
00092 for i in range(0,int(sys.argv[1])):
00093
00094
00095
00096
00097
00098 f.write('ROS_INFO("test");')
00099 f.write('ROS_WARN("test");')
00100 f.write('ROS_ERROR("test");')
00101 f.write('ROS_DEBUG("test");')
00102 f.write('ROS_ERROR("test");')
00103
00104 f.write('}\n')
00105 f.write('}\n')
00106