Stxxl
1.4.0
|
00001 /*************************************************************************** 00002 * common/log.cpp 00003 * 00004 * Part of the STXXL. See http://stxxl.sourceforge.net 00005 * 00006 * Copyright (C) 2004-2005 Roman Dementiev <dementiev@ira.uka.de> 00007 * Copyright (C) 2008 Johannes Singler <singler@ira.uka.de> 00008 * Copyright (C) 2009 Andreas Beckmann <beckmann@cs.uni-frankfurt.de> 00009 * 00010 * Distributed under the Boost Software License, Version 1.0. 00011 * (See accompanying file LICENSE_1_0.txt or copy at 00012 * http://www.boost.org/LICENSE_1_0.txt) 00013 **************************************************************************/ 00014 00015 #include <stxxl/bits/common/log.h> 00016 00017 00018 __STXXL_BEGIN_NAMESPACE 00019 00020 logger::logger() : waitlog_stream_(NULL) 00021 { 00022 const char * log_filename = getenv("STXXLLOGFILE"); 00023 log_stream_.open(log_filename == NULL ? "stxxl.log" : log_filename); 00024 const char * errlog_filename = getenv("STXXLERRLOGFILE"); 00025 errlog_stream_.open(errlog_filename == NULL ? "stxxl.errlog" : errlog_filename); 00026 #ifdef STXXL_WAIT_LOG_ENABLED 00027 const char * waitlog_filename = getenv("STXXLWAITLOGFILE"); 00028 if (waitlog_filename) { 00029 waitlog_stream_ = new std::ofstream(waitlog_filename); 00030 *waitlog_stream_ << "# time\trd_incr\twr_incr\tw_read\tw_write" << std::endl; 00031 } 00032 #endif 00033 } 00034 00035 logger::~logger() 00036 { 00037 delete waitlog_stream_; 00038 } 00039 00040 __STXXL_END_NAMESPACE