diff MeasVMS.h @ 0:e123acb162f0

Initial add of MeasVMS semantic layer Works, but has weird suspend-time histogram -- will try moving hist updates out of coreloop & out of master and into the app
author Me
date Sat, 11 Sep 2010 03:25:03 -0700
parents
children bfa2fe3552e4
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/MeasVMS.h	Sat Sep 11 03:25:03 2010 -0700
     1.3 @@ -0,0 +1,138 @@
     1.4 +/*
     1.5 + *  Copyright 2009 OpenSourceStewardshipFoundation.org
     1.6 + *  Licensed under GNU General Public License version 2
     1.7 + *
     1.8 + * Author: seanhalle@yahoo.com
     1.9 + *
    1.10 + */
    1.11 +
    1.12 +#ifndef _MeasVMS_H
    1.13 +#define	_MeasVMS_H
    1.14 +
    1.15 +#include "VMS/Queue_impl/PrivateQueue.h"
    1.16 +#include "VMS/Hash_impl/PrivateHash.h"
    1.17 +#include "VMS/Histogram/Histogram.h"
    1.18 +#include "VMS/VMS.h"
    1.19 +
    1.20 +/*This header defines everything specific to the MeasVMS semantic plug-in
    1.21 + */
    1.22 +typedef struct _MeasVMSSemReq   MeasVMSSemReq;
    1.23 +
    1.24 +
    1.25 +/*Semantic layer-specific data sent inside a request from lib called in app
    1.26 + * to request handler called in MasterLoop
    1.27 + */
    1.28 +enum MeasVMSReqType
    1.29 + {
    1.30 +   send_type = 1,
    1.31 +   send_from_to,
    1.32 +   receive_any,    //order and grouping matter -- send before receive
    1.33 +   receive_type,   // and receive_any first of the receives -- Handlers
    1.34 +   receive_from_to,// rely upon this ordering of enum
    1.35 +   transfer_to,
    1.36 +   transfer_out
    1.37 + };
    1.38 +
    1.39 +struct _MeasVMSSemReq
    1.40 + { enum MeasVMSReqType    reqType;
    1.41 +   VirtProcr           *sendPr;
    1.42 +   VirtProcr           *receivePr;
    1.43 +   int32                msgType;
    1.44 +   void                *msg;
    1.45 +   MeasVMSSemReq         *nextReqInHashEntry;
    1.46 + }
    1.47 +/* MeasVMSSemReq */;
    1.48 +
    1.49 +typedef struct
    1.50 + {
    1.51 +   PrivQueueStruc **readyVPQs;
    1.52 +   int              numVirtPr;
    1.53 +   int              numTimesCalled;
    1.54 +   int              firstOfTwo;
    1.55 +   int              nextCoreToGetNewPr;
    1.56 +
    1.57 +   Histogram      **addrOfSuspHist;
    1.58 +   Histogram      **addrOfMasterHist;
    1.59 + }
    1.60 +MeasVMSSemEnv;
    1.61 +
    1.62 +
    1.63 +typedef struct
    1.64 + {
    1.65 +    Histogram **suspHistAddr;
    1.66 +    Histogram **masterHistAddr;
    1.67 + }
    1.68 +PairOfHistAddresses;
    1.69 +
    1.70 +//===========================================================================
    1.71 +
    1.72 +void
    1.73 +MeasVMS__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
    1.74 +
    1.75 +//=======================
    1.76 +
    1.77 +void
    1.78 +MeasVMS__init();
    1.79 +
    1.80 +void
    1.81 +MeasVMS__cleanup_after_shutdown();
    1.82 +
    1.83 +//=======================
    1.84 +
    1.85 +inline VirtProcr *
    1.86 +MeasVMS__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
    1.87 +                          VirtProcr *creatingPr );
    1.88 +
    1.89 +void
    1.90 +MeasVMS__dissipate_procr( VirtProcr *procrToDissipate );
    1.91 +
    1.92 +//=======================
    1.93 +void *
    1.94 +MeasVMS__malloc_size_to( int numBytes, VirtProcr *ownerPr );
    1.95 +
    1.96 +void
    1.97 +MeasVMS__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
    1.98 +                                                    VirtProcr *newOwnerPr );
    1.99 +                                                    
   1.100 +void
   1.101 +MeasVMS__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
   1.102 +
   1.103 +void
   1.104 +MeasVMS__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
   1.105 +
   1.106 +void
   1.107 +MeasVMS__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
   1.108 +
   1.109 +
   1.110 +
   1.111 +//=======================
   1.112 +void
   1.113 +MeasVMS__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
   1.114 +                        VirtProcr *receivePr);
   1.115 +
   1.116 +void
   1.117 +MeasVMS__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
   1.118 +
   1.119 +void *
   1.120 +MeasVMS__receive_type_to( const int type, VirtProcr *receivePr );
   1.121 +
   1.122 +void *
   1.123 +MeasVMS__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
   1.124 +
   1.125 +
   1.126 +//=======================
   1.127 +
   1.128 +void
   1.129 +MeasVMS__free_semantic_request( MeasVMSSemReq *semReq );
   1.130 +
   1.131 +
   1.132 +//=========================  Internal use only  =============================
   1.133 +void
   1.134 +MeasVMS__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
   1.135 +
   1.136 +VirtProcr *
   1.137 +MeasVMS__schedule_virt_procr( void *_semEnv, int coreNum );
   1.138 +
   1.139 +
   1.140 +#endif	/* _MeasVMS_H */
   1.141 +