Sirikata
libspace/include/sirikata/space/OSegLookupTraceToken.hpp
Go to the documentation of this file.
00001 /*  Sirikata
00002  *  OSegLookupTraceToken.hpp
00003  *
00004  *  Copyright (c) 2010, Daniel Reiter Horn
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions are
00009  *  met:
00010  *  * Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  *  * Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in
00014  *    the documentation and/or other materials provided with the
00015  *    distribution.
00016  *  * Neither the name of Sirikata nor the names of its contributors may
00017  *    be used to endorse or promote products derived from this software
00018  *    without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00021  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00022  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00023  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00024  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00026  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00027  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00028  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00029  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00030  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  */
00032 
00033 
00034 #ifndef __OSEG_LOOKUP_TRACE_TOKEN__
00035 #define __OSEG_LOOKUP_TRACE_TOKEN__
00036 
00037 #include <sirikata/space/Platform.hpp>
00038 #include <sirikata/core/util/UUID.hpp>
00039 
00040 namespace Sirikata
00041 {
00042 
00043 
00044   struct SIRIKATA_SPACE_EXPORT OSegLookupTraceToken
00045   {
00046       enum OSegTraceStage
00047       {
00048           OSEG_TRACE_INITIAL_LOOKUP_TIME,
00049           OSEG_TRACE_CHECK_CACHE_LOCAL_BEGIN,
00050           OSEG_TRACE_CHECK_CACHE_LOCAL_END,
00051           OSEG_TRACE_CRAQ_LOOKUP_BEGIN,
00052           OSEG_TRACE_CRAQ_LOOKUP_END,
00053           OSEG_TRACE_CRAQ_LOOKUP_NOT_ALREADY_LOOKING_UP_BEGIN,
00054           OSEG_TRACE_CRAQ_LOOKUP_NOT_ALREADY_LOOKING_UP_END,
00055           OSEG_TRACE_GET_MANAGER_ENQUEUE_BEGIN,
00056           OSEG_TRACE_GET_MANAGER_ENQUEUE_END,
00057           OSEG_TRACE_GET_MANAGER_DEQUEUED,
00058           OSEG_TRACE_GET_CONNECTION_NETWORK_GET_BEGIN,
00059           OSEG_TRACE_GET_CONNECTION_NETWORK_GET_END,
00060           OSEG_TRACE_GET_CONNECTION_NETWORK_RECEIVED,
00061           OSEG_TRACE_LOOKUP_RETURN_BEGIN,
00062           OSEG_TRACE_LOOKUP_RETURN_END
00063       };
00064 
00065       
00066       OSegLookupTraceToken(const UUID& uID,bool loggingOn);
00067       OSegLookupTraceToken(bool loggingOn);
00068 
00069     /*****Additional***/
00070     UUID mID;
00071     ServerID lookerUpper;
00072     ServerID locatedOn;
00073 
00074     bool mLoggingOn;
00075     
00076     /********FLAGS********/
00077     //AsyncConnectionGet::get
00078     bool notReady;
00079     //Lots of places
00080     bool shuttingDown;
00081     //AsyncConnectionGet::queryTimeout
00082     bool deadlineExpired;
00083     //AsyncConnectionGet::processNotFound
00084     bool notFound;
00085 
00086 
00087     /***TIMES****/
00088     //CraqObjectSegmentation::get
00089     uint64 initialLookupTime;
00090 
00091     //CraqObjectSegmentation::get
00092     uint64 checkCacheLocalBegin;
00093 
00094     //CraqObjectSegmentation::get
00095     uint64 checkCacheLocalEnd;
00096 
00097     uint64 osegQLenPostQuery;
00098 
00099     //CraqObjectSegmentation::beginning of beginCraqLookup //anything that gets to beginCraqLookupGets to here
00100     uint64 craqLookupBegin;
00101 
00102     //CraqObjectSegmentation::end of beginCraqLookup
00103     uint64 craqLookupEnd;
00104 
00105     //CraqObjectSegmentation::beginCraqLookup//wasn't already being looked up begin
00106     uint64 craqLookupNotAlreadyLookingUpBegin;
00107 
00108     //CraqObjectSegmentation::beginCraqLookup
00109     uint64 craqLookupNotAlreadyLookingUpEnd;
00110 
00111     //AsyncCraqGet::get
00112     uint64 getManagerEnqueueBegin;
00113 
00114     //AsyncCraqGet::get
00115     uint64 getManagerEnqueueEnd;
00116 
00117     //AsyncCraqGet::checkConnections
00118     uint64 getManagerDequeued;
00119 
00120     //AsyncConnectionGet::get
00121     uint64 getConnectionNetworkGetBegin;
00122 
00123     //AsyncConnectionGet::get
00124     uint64 getConnectionNetworkGetEnd;
00125 
00126     //AsyncConnectionGet::processValueFound
00127     uint64 getConnectionNetworkReceived;
00128 
00129     uint64 osegQLenPostReturn;
00130 
00131     //CraqObjectSegmentation:craqGetResult
00132     uint64 lookupReturnBegin;
00133 
00134     //CraqObjectSegmentation:craqGetResult
00135     uint64 lookupReturnEnd;
00136 
00137     void printCumulativeTraceToken();
00138     void stamp(OSegTraceStage osts);
00139   };
00140 }
00141 
00142 #endif