int queryDevices(String command) { if(command == "auto") { // sets and prints the device array for(int i=0; i < deviceCount; i++ ) { sensor.getAddress(deviceIndexArray[i], i); Serial.print("Device Index "); Serial.print(i); printAddress(deviceIndexArray[i]); Serial.print("\n"); } Serial.print("----------------------------------\n"); return 1; } if(command == "array" ) { // prints the device Array but does not set it Serial << "Display deviceIndexArray " << endl << "----------------------------------\n" << endl; for ( int i=0; i < 5; i++ ) { Serial << "\n deviceIndexArray[" << i << "]: "; printAddress(deviceIndexArray[i]); } Serial << "\n----------------------------------\n" << endl; } }
void setup() { // Note: Ethernet shield uses digitial IO pins 10,11,12, and 13 Serial.begin(9600); Serial.println(version); Serial.println(); // locate devices on the 1Wire bus Serial.print("Locating devices on 1Wire bus..."); sensors.begin(); int count = sensors.getDeviceCount(); Serial.print("Found "); Serial.print( count ); Serial.println(" devices on 1wire bus"); // select the first sensor for ( int i=0; i<count; i++ ) { if ( sensors.getAddress(thermometer, i) ) { Serial.print("1wire device "); Serial.print(i); Serial.print(" has address: "); printAddress(thermometer); Serial.println(); } else { Serial.print("Unable to find address for 1wire device "); Serial.println( i ); } } // if you want to use a particular sensor, you can hard code it here if (0) { DeviceAddress addr = { 0x10, 0xE4, 0xF1, 0xD2, 0x01, 0x08, 0x00, 0xBE }; for (uint8_t i = 0; i < 8; i++) { thermometer[i] = addr[i]; } } // show the addresses we found on the bus Serial.print("Using 1wire device: "); printAddress(thermometer); Serial.println(); // set the resolution to 9 bit sensors.setResolution(thermometer, 9); dhcpInit(); }
int queryDevices(String command) { if(command == "auto") { // sets and prints the device array for(int i=0; i < deviceCount; i++ ) { sensor.getAddress(deviceIndexArray[i], i); Serial.print("Device Index "); Serial.print(i); printAddress(deviceIndexArray[i]); Serial.print("\n"); } Serial.print("----------------------------------\n"); return 1; } if(command == "array" ) { // prints the device Array but does not set it Serial << "Display deviceIndexArray " << endl << "----------------------------------\n" << endl; for ( int i=0; i < 5; i++ ) { Serial << "\n deviceIndexArray[" << i << "]: "; printAddress(deviceIndexArray[i]); } Serial << "\n----------------------------------\n" << endl; return 1; } if(command == "invert" ) { oled.command(INVERTDISPLAY); Serial << "normal display " << endl; return 1; } if(command == "normal" ) { Serial << "normal display " << endl; oled.command(NORMALDISPLAY); return 1; } if(command == "sysver" ) { Serial << "System Version " << System.version().c_str() << endl; return 1; } else return -1; }
//Check the reply message received at the coordinator void MP2Node::checkReplyMessages() { int curr_time = par->getcurrtime(); //get current time map<int, transaction_details>::iterator it = this->transaction_count.begin(); cout << "For server = "; printAddress(&getMemberNode()->addr); cout << endl; pair<int, int> rep_count; int acks = 0, nacks = 0; while(it != this->transaction_count.end()) { // iterate over each pending transaction whose ack or nack not received. rep_count = this->countAcks(it->first); // count the number of acks and nacks acks = rep_count.first; nacks = rep_count.second; if ( (acks + nacks) <= 2){ if (acks == 2){ // if ack == 2, the quorum in +ve replies so, log success at coordinator this->logCoordinatorSuccess(it); } else { // otherwise check if the reply by the server has timeout. If yes, then log failure if ((curr_time - it->second.timestamp) >= Reply_Timeout) { this->logCoordinatorFailure(it); } } } else { if (acks < nacks){ // if acks < nacks when count = 3, then check for timeout and log failure if necessary. if ((curr_time - it->second.timestamp) >= Reply_Timeout) { this->logCoordinatorFailure(it); } } else { // Otherwise log success at coordinator. this->logCoordinatorSuccess(it); } } it++; } }
/**************************************************************************** Desc: Generates the html to display a row in a table. If *ppSCache is a valid pointer, then that line will have hyperlinks in it. ****************************************************************************/ FSTATIC void flmPrintCacheLine( HRequest * pHRequest, const char * pszHREF, const char * pszName, void * pBaseAddr, SCACHE ** ppSCache) { char szAddress[20]; char szOffset[8]; PRINTF_FN fnPrintf = gv_FlmSysData.HttpConfigParms.fnPrintf; printAddress( *ppSCache, szAddress); printOffset( pBaseAddr, ppSCache, szOffset); if ((*ppSCache) && (*ppSCache)->pFile && pszHREF) { // We have a pointer to a valid SCache block and a valid HREF string, // so we need hyperlinks to appear in the browser... fnPrintf( pHRequest, TD_s TD_a_s_s " </td> <td> SCACHE * </td> " TD_a_s_s TR_END, szOffset, pszHREF, pszName, pszHREF, szAddress); } else { fnPrintf( pHRequest, TD_s TD_s " <td> SCACHE * </td> " TD_s TR_END, szOffset, pszName, szAddress ); } }
int main(){ while( 0 == 0 ) { printMenu(); printf("Enter command: "); scanf("%s", choice); if (choice[0]=='i'){ interactive(); } else if (choice[0]=='a'){ automatic(); } else if (choice[0]=='e'){ printf("exiting\n\n"); break; } else printf("Please enter a valid option\n"); if (status == 1){ //only print the final addresses if everything has gone accordingly printAddress(); status=0; //reset status } } return EXIT_SUCCESS; }
void MyEnvironment::dallasInit(){ Serial.println("Dallas Temperature IC Control Library Demo"); // locate devices on the bus Serial.print("Locating devices..."); _dallas.begin(); Serial.print("Found "); Serial.print(_dallas.getDeviceCount(), DEC); Serial.println(" devices."); // report parasite power requirements Serial.print("Parasite power is: "); if (_dallas.isParasitePowerMode()) Serial.println("ON"); else Serial.println("OFF"); if (!_dallas.getAddress(_waterThermometer, 0)) { Serial.println("Unable to find address for Device 0"); }else { // show the addresses we found on the bus Serial.print("Device 0 Address: "); printAddress(_waterThermometer); Serial.println(); // set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions) _dallas.setResolution(_waterThermometer, 9); Serial.print("Device 0 Resolution: "); Serial.print(_dallas.getResolution(_waterThermometer), DEC); Serial.println(); } }
/** * FUNCTION NAME: clientCreate * * DESCRIPTION: client side CREATE API * The function does the following: * 1) Constructs the message * 2) Finds the replicas of this key * 3) Sends a message to the replica */ void MP2Node::clientCreate(string key, string value) { /* * Implement this */ /* * Hash the key and modulo by number of members in the ring * Find the Node where that key should be present * Also, replicate that key on the next 2 neighbors * Message all those nodes to save this key */ // find the destination 3 nodes where this key needs to go vector<Node> destination_nodes = findNodes(key); // print the location of nodes just for debugging for(int i = 0; i < destination_nodes.size(); i++){ cout << "Key = " << key << " Replica = "; printAddress(destination_nodes[i].getAddress()); cout << endl; } // Create a create message with key and value and replica type and send each replica create message according to its type Message *msg; ReplicaType type; for (int i = 0; i < RF; i++){ // Loop over each replica type = static_cast<ReplicaType>(i); // convert int type into enum ReplicaType msg = new Message(this->transaction_id, getMemberNode()->addr, CREATE, key, value, type); //create a create type message emulNet->ENsend(&getMemberNode()->addr, destination_nodes[i].getAddress(), msg->toString()); free(msg); // free message } // Increment this node transaction_id and set other transaction details like key, value and MessageType initTransactionCount(this->transaction_id++, key, value, CREATE); }
void OnewireManager::Init() { m_refreshTimer.Init(); m_sensorList = (TemperatureSensor**)malloc ( sensors->getDeviceCount() * sizeof(TemperatureSensor*) ); for(int i=0;i<sensors->getDeviceCount();i++) { DeviceAddress newAddr; if (!sensors->getAddress(newAddr, i)) { Serial.println("No more device found"); break; } else { sensors->setResolution(newAddr, 12); Serial.print("Sensor address "); printAddress(newAddr); Serial.print(", Resolution: "); Serial.println(sensors->getResolution(newAddr), DEC); m_sensorList[m_iNbDevice] = new TemperatureSensor(99, newAddr); manager.AddModule(m_sensorList[m_iNbDevice]); ++m_iNbDevice; } } Update(); }
void addStack(void) { // create an array that won't be optimized out by compiler int i = 5; // Calling this function should add printAddress("&i inside function (stack)", &i); }
void list(struct Connection *conn) { for (int i = 0; i < MAX_ROWS; i++) { struct Address *addr = &conn->db->rows[i]; if (addr->set) printAddress(addr); } }
void setup(void) { // start serial port Serial.begin(9600); Serial.println("Dallas Temperature IC Control Library Demo"); // locate devices on the bus Serial.print("Locating devices..."); sensors.begin(); Serial.print("Found "); Serial.print(sensors.getDeviceCount(), DEC); Serial.println(" devices."); // report parasite power requirements Serial.print("Parasite power is: "); if (sensors.isParasitePowerMode()) Serial.println("ON"); else Serial.println("OFF"); // assign address manually. the addresses below will beed to be changed // to valid device addresses on your bus. device address can be retrieved // by using either oneWire.search(deviceAddress) or individually via // sensors.getAddress(deviceAddress, index) //insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 }; // Method 1: // search for devices on the bus and assign based on an index. ideally, // you would do this to initially discover addresses on the bus and then // use those addresses and manually assign them (see above) once you know // the devices on your bus (and assuming they don't change). if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0"); // method 2: search() // search() looks for the next device. Returns 1 if a new address has been // returned. A zero might mean that the bus is shorted, there are no devices, // or you have already retrieved all of them. It might be a good idea to // check the CRC to make sure you didn't get garbage. The order is // deterministic. You will always get the same devices in the same order // // Must be called before search() //oneWire.reset_search(); // assigns the first address found to insideThermometer //if (!oneWire.search(insideThermometer)) Serial.println("Unable to find address for insideThermometer"); // show the addresses we found on the bus Serial.print("Device 0 Address: "); printAddress(insideThermometer); Serial.println(); // set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions) sensors.setResolution(insideThermometer, 9); Serial.print("Device 0 Resolution: "); Serial.print(sensors.getResolution(insideThermometer), DEC); Serial.println(); }
void PExport::printValue(PolyWord q) { if (IS_INT(q) || q == PolyWord::FromUnsigned(0)) fprintf(exportFile, "%" POLYSFMT, UNTAGGED(q)); else if (OBJ_IS_CODEPTR(q)) printCodeAddr(q.AsCodePtr()); else printAddress(q.AsAddress()); }
/*----------------------------------------------------------------------------*/ int main(void) { static const char separator[] = "-----------------------\r\n"; struct Interface * const ow = init(OneWireSsp, &owConfig); assert(ow); struct Interface * const serial = init(Serial, &serialConfig); assert(serial); struct Timer * const timer = init(GpTimer, &timerConfig); assert(timer); timerSetOverflow(timer, 2000); bool busEvent = false; ifSetCallback(ow, onBusEvent, &busEvent); bool timerEvent = false; timerSetCallback(timer, onTimerOverflow, &timerEvent); timerEnable(timer); while (1) { while (!timerEvent) barrier(); timerEvent = false; enum Result res; res = ifSetParam(ow, IF_ONE_WIRE_START_SEARCH, 0); assert(res == E_OK); do { while (!busEvent) barrier(); busEvent = false; res = ifGetParam(ow, IF_STATUS, 0); if (res != E_OK) break; uint64_t address; res = ifGetParam(ow, IF_ADDRESS, &address); assert(res == E_OK); printAddress(serial, address); } while (ifSetParam(ow, IF_ONE_WIRE_FIND_NEXT, 0) == E_OK); ifWrite(serial, separator, sizeof(separator) - 1); } return 0; }
/** * * Assign successors and predecessors to this node i.e. change hasMyReplicas and haveReplicasOf * */ void MP2Node::assignReplicationNodes() { Node this_node = Node(getMemberNode()->addr); if (hasMyReplicas.empty() || haveReplicasOf.empty()) { for (int i = 0; i < ring.size(); i++) { // Loop over ring size if (isNodeSame(ring[i], this_node)){ // When you find the current Node, then assign predecessors and successors. if (i == 0){ // if node is at 0 location, then this node contains the replicas of last and second last members in the ring haveReplicasOf.push_back(Node(*ring[ring.size() - 1].getAddress())); haveReplicasOf.push_back(Node(*ring[ring.size() - 2].getAddress())); } else if (i == 1){ // if node is at 1 location, then this node contains the replicas of 0th and last member in the ring haveReplicasOf.push_back(Node(*ring[0].getAddress())); haveReplicasOf.push_back(Node(*ring[ring.size() - 1].getAddress())); } else { // If no boundary conditions then, this node contains the replicas of the previous 2 nodes. Modulo just in case :) haveReplicasOf.push_back(Node(*ring[(i - 1) % ring.size()].getAddress())); haveReplicasOf.push_back(Node(*ring[(i - 2) % ring.size()].getAddress())); } // The replicas of this node will be at the next 2 nodes, hash so as to cover the case when next or next to next node is in the begining of the ring hasMyReplicas.push_back(Node(*ring[(i + 1) % ring.size()].getAddress())); hasMyReplicas.push_back(Node(*ring[(i + 2) % ring.size()].getAddress())); } } } // Just the debugging log to check if new and old rings are what they needs to be. cout << "Ring is as follows : " << endl; for (int i = 0; i < ring.size(); i++){ printAddress(ring[i].getAddress()); cout << " "; } cout << endl; cout << "Replicas of "; printAddress(&getMemberNode()->addr); cout << " are at " << endl; for (int i = 0; i < hasMyReplicas.size(); i++){ printAddress(hasMyReplicas[i].getAddress()); cout << endl; } cout << " and it has replicas of " << endl; for (int i = 0; i < haveReplicasOf.size(); i++){ printAddress(haveReplicasOf[i].getAddress()); cout << endl; } }
void get(struct Connection *conn, int id) { struct Address *addr = &conn->db->rows[id]; if (addr->set) { printAddress(addr); } else { die("Id is not set"); } }
void setup(void) { // start serial port Serial.begin(38400); delay(1000); Serial.println("Dallas Temperature IC Control Library Demo"); // Start up the library sensors.begin(); // Grab a count of devices on the wire numberOfDevices = sensors.getDeviceCount(); // locate devices on the bus Serial.print("Locating devices..."); Serial.print("Found "); Serial.print(numberOfDevices, DEC); Serial.println(" devices."); // report parasite power requirements Serial.print("Parasite power is: "); if (sensors.isParasitePowerMode()) Serial.println("ON"); else Serial.println("OFF"); // Loop through each device, print out address for(int i=0;i<numberOfDevices; i++) { // Search the wire for address if(sensors.getAddress(tempDeviceAddress, i)) { Serial.print("Found device "); Serial.print(i, DEC); Serial.print(" with address: "); printAddress(tempDeviceAddress); Serial.println(); Serial.print("Setting resolution to "); Serial.println(TEMPERATURE_PRECISION, DEC); // set the resolution to TEMPERATURE_PRECISION bit (Each Dallas/Maxim device is capable of several different resolutions) sensors.setResolution(tempDeviceAddress, TEMPERATURE_PRECISION); Serial.print("Resolution actually set to: "); Serial.print(sensors.getResolution(tempDeviceAddress), DEC); Serial.println(); }else{ Serial.print("Found ghost device at "); Serial.print(i, DEC); Serial.print(" but could not detect address. Check power and cabling"); } } }
void TempSensors::setup() { dallasTemperature.setWaitForConversion(false); dallasTemperature.requestTemperatures(); debug->println("TempSensors:"); for (int i = 0; i < sensorCount; i++) { debug->print(i); debug->print(" "); debug->print(_tempSensors[i]._label); debug->print(" "); printAddress(_tempSensors[i]._deviceAddress); debug->print(" "); getAndPrintTemperature(_tempSensors[i]._deviceAddress); debug->println(); } }
// Handle the normal reply messages coming at the coordinator void MP2Node::processNodesReply(Message incoming_msg) { Address from_addr(incoming_msg.fromAddr); // address from where the ack or nack came int _trans_id = incoming_msg.transID;// get trans_id from the incoming message bool success = incoming_msg.success;// success status returned by the server cout << "I got a reply from "; printAddress(&from_addr); cout << endl; // if status success save the ack as +ve ack otherwise -ve ack for the specific transaction id of the operation if (success) incTransactionReplyCount(_trans_id, 1, ""); else incTransactionReplyCount(_trans_id, -1, ""); }
void getAddress(float lat, float lon,std::string &address){ bool placeIDExist(false); mapValue.clear(); pqxx::nontransaction nType((*ptrConn)); for (int i=0; i < 10; ++i){ sql="select place_id,parent_place_id,rank_search from placex WHERE ST_DWithin(ST_SetSRID(ST_Point("+std::to_string(lon)+","+std::to_string(lat)+"),4326), " "geometry, "+std::to_string(radius)+") and rank_search != 28 and rank_search >= 26 and (name is not null or housenumber is not null) and" " class not in ('waterway','railway','tunnel','bridge') and indexed_status = 0 and " "(ST_GeometryType(geometry) not in ('ST_Polygon','ST_MultiPolygon') " "OR ST_DWithin(ST_SetSRID(ST_Point("+std::to_string(lon)+","+std::to_string(lat)+"),4326), centroid, "+std::to_string(radius)+")) " "ORDER BY ST_distance(ST_SetSRID(ST_Point("+std::to_string(lon)+","+std::to_string(lat)+"),4326), geometry) ASC limit 1"; //std::cout << sql << std::endl; resultSet = nType.exec(sql); if (!resultSet.empty()) { for (pqxx::result::const_iterator c = resultSet.begin(); c != resultSet.end(); ++c){ //cout << '\t' << c[0].as(string()) << '\t' << c[1].as(string()) <<'\t' << c[2].as(string()) <<endl; place_id = c[0].as(std::string()); } placeIDExist=true; break; } radius*=2; }// end of for loop if(placeIDExist){ resultSet = nType.exec("select name,class,type from get_addressdata(" + place_id + ") where isaddress order by rank_address asc"); if (!resultSet.empty()) { for (pqxx::result::const_iterator c = resultSet.begin(); c != resultSet.end(); ++c){ parseLocation( c[0].as(std::string()), c[1].as(std::string()), c[2].as(std::string())); } } } printAddress(address); } // end of func getAddress
// cling::Value std::string printValue(const Value *value) { cling::smallstream strm; if (value->isValid()) { clang::ASTContext &C = value->getASTContext(); clang::QualType QT = value->getType(); strm << "boxes ["; strm << enclose(QT, C, "(", ") ", 3); if (!QT->isVoidType()) { strm << printUnpackedClingValue(*value); } strm << "]"; } else strm << "<<<invalid>>> " << printAddress(value, '@'); return strm.str(); }
/**************************************************************************** Desc: Determines the values of the parameters needed to reference a specific SCache block. Must be called from within a mutex ****************************************************************************/ FSTATIC void flmBuildSCacheBlockString( char * pszString, SCACHE * pSCache) { char szAddress[ 20]; if ((pSCache == NULL) || (pSCache->pFile == NULL)) { pszString[0] = 0; } else { printAddress( pSCache->pFile, szAddress); f_sprintf( (char *)pszString, "%s/SCacheBlock?BlockAddress=%lu&File=%s&LowTransID=%lu&HighTransID=%lu", gv_FlmSysData.HttpConfigParms.pszURLString, pSCache->uiBlkAddress, szAddress, scaGetLowTransID( pSCache), pSCache->uiHighTransID); } return; }
void TempSensors::diagSensors() { // Start up the library dallasTemperature.begin(); // Grab a count of devices on the wire numberOfDevices = dallasTemperature.getDeviceCount(); // locate devices on the bus debug->println("Locating devices..."); debug->print("Found "); debug->print(numberOfDevices, DEC); debug->println(" devices."); // report parasite power requirements debug->print("Parasite power is: "); if (dallasTemperature.isParasitePowerMode()) debug->println("ON"); else debug->println("OFF"); // Loop through each device, print out address for (int i = 0; i < numberOfDevices; i++) { // Search the wire for address if (dallasTemperature.getAddress(tempDeviceAddress, i)) { debug->print("Found device "); debug->print(i, DEC); debug->print(" with address: "); printAddress(tempDeviceAddress); debug->println(); debug->print("Setting resolution to "); debug->println(TEMPERATURE_PRECISION, DEC); // set the resolution to TEMPERATURE_PRECISION bit (Each Dallas/Maxim device is capable of several different resolutions) dallasTemperature.setResolution(tempDeviceAddress, TEMPERATURE_PRECISION); debug->print("Resolution actually set to: "); debug->print(dallasTemperature.getResolution(tempDeviceAddress), DEC); debug->println(); } else { debug->print("Found ghost device at "); debug->print(i, DEC); debug->print(" but could not detect address. Check power and cabling"); } } }
/**************************************************************************** Desc: This procedure generates the HTML page to display the contents of the FFile structure ****************************************************************************/ void F_FFilePage::write_data( FFILE * pFile, void * pvFFileAddress, DATASTRUCT * pDataStruct) { char szFormattedTime[13]; char szTemp[100]; char szAddress[20]; char szFFileAddress[20]; FLMBOOL bHighlight = FALSE; F_UNREFERENCED_PARM( fnPrintf); if (pFile == NULL) { flmAssert(0); return; } else { printAddress( pvFFileAddress, szFFileAddress); // pNext if ( pFile->pNext) { f_sprintf( (char *)szTemp, "%s/FFile?From=FFile?Link=pNext?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pNext", "FFILE *", (void *)pFile, (void *)&pFile->pNext, (void *)pFile->pNext, (char *)szTemp, (bHighlight = ~bHighlight)); // pPrev - previous file in hash bucket. if (pFile->pPrev) { f_sprintf( (char *)szTemp, "%s/FFile?From=FFile?Link=pPrev?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pPrev", "FFILE *", (void *)pFile, (void *)&pFile->pPrev, (void *)pFile->pPrev, (char *)szTemp, (bHighlight = ~bHighlight)); // uiZeroUseCountTime - Time Use Count went to zero FormatTime(pFile->uiZeroUseCountTime, szFormattedTime); printHTMLString( "uiZeroUseCountTime", "FLMUINT", (void *)pFile, (void *)&pFile->uiZeroUseCountTime, (char *)szFormattedTime, (bHighlight = ~bHighlight)); // uiInternalUseCount - Internal Use Count printHTMLUint( "uiInternalUseCount", "FLMUINT", (void *)pFile, (void *)&pFile->uiInternalUseCount, pFile->uiInternalUseCount, (bHighlight = ~bHighlight)); // uiUseCount - Current Use Count printHTMLUint( "uiUseCount", "FLMUINT", (void *)pFile, (void *)&pFile->uiUseCount, pFile->uiUseCount, (bHighlight = ~bHighlight)); // pFirstDb if (pFile->pFirstDb) { char szFDBAddr[20]; printAddress( pFile->pFirstDb, szAddress); f_sprintf( szFDBAddr, "%s", szAddress); f_sprintf( (char *)szTemp, "%s/FDB?FFileAddress=%s?Bucket=%lu?FDBAddress=%s", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket, szFDBAddr); } printHTMLLink( "pFirstDb", "FDB *", (void *)pFile, (void *)&pFile->pFirstDb, (void *)pFile->pFirstDb, (char *)szTemp, (bHighlight = ~bHighlight)); // pszDbPath - Database File Name printHTMLString( "pszDbPath", "FLMBYTE *", (void *)pFile, (void *)&pFile->pszDbPath, (char *)(pFile->pszDbPath ? (char *)pFile->pszDbPath : "Null"), (bHighlight = ~bHighlight)); // pszDataDir printHTMLString( "pszDataDir", "FLMBYTE *", (void *)pFile, (void *)&pFile->pszDataDir, (char *)(pFile->pszDataDir ? (char *)pFile->pszDataDir : "Null"), (bHighlight = ~bHighlight)); // pNextNUFile - Next Not Used File if (pFile->pNextNUFile) { f_sprintf( (char *)szTemp, "%s/FFile?From=FFile?Link=pNextNUFile?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pNextNUFile", "FFILE *", (void *)pFile, (void *)&pFile->pNextNUFile, (void *)pFile->pNextNUFile, (char *)szTemp, (bHighlight = ~bHighlight)); // pPrevNUFile - Previous Not Used File if (pFile->pPrevNUFile) { f_sprintf( (char *)szTemp, "%s/FFile?From=FFile?Link=pPrevNUFile?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pPrevNUFile", "FFILE *", (void *)pFile, (void *)&pFile->pPrevNUFile, (void *)pFile->pPrevNUFile, (char *)szTemp, (bHighlight = ~bHighlight)); // pSCacheList - Shared Cache Blocks if (pFile->pSCacheList) { f_sprintf( (char *)szTemp, "%s/SCacheBlock?" "BlockAddress=%ld&File=%s&LowTransID=%ld&HighTransID=%ld", m_pszURLString, pDataStruct->SCacheBlkAddress, szFFileAddress, pDataStruct->SCacheLowTransID, pDataStruct->SCacheHighTransID); } printHTMLLink( "pSCacheList", "SCACHE *", (void *)pFile, (void *)&pFile->pSCacheList, (void *)pFile->pSCacheList, (char *)szTemp, (bHighlight = ~bHighlight)); // pPendingWriteList if (pFile->pPendingWriteList) { f_sprintf( (char *)szTemp, "%s/SCacheBlock?" "BlockAddress=%ld&File=%s&LowTransID=%ld&HighTransID=%ld", m_pszURLString, pDataStruct->PendingWriteBlkAddress, szFFileAddress, pDataStruct->PendingWriteLowTransID, pDataStruct->PendingWriteHighTransID); } printHTMLLink( "pPendingWriteList", "SCACHE *", (void *)pFile, (void *)&pFile->pPendingWriteList, (void *)pFile->pPendingWriteList, (char *)szTemp, (bHighlight = ~bHighlight)); // pLastDirtyBlk if (pFile->pLastDirtyBlk) { f_sprintf( (char *)szTemp, "%s/SCacheBlock?" "BlockAddress=%ld&File=%s&LowTransID=%ld&HighTransID=%ld", m_pszURLString, pDataStruct->LastDirtyBlkAddress, szFFileAddress, pDataStruct->LastDirtyLowTransID, pDataStruct->LastDirtyHighTransID); } printHTMLLink( "pLastDirtyBlk", "SCACHE *", (void *)pFile, (void *)&pFile->pLastDirtyBlk, (void *)pFile->pLastDirtyBlk, (char *)szTemp, (bHighlight = ~bHighlight)); // uiDirtyCacheCount printHTMLUint( "uiDirtyCacheCount", "FLMUINT", (void *)pFile, (void *)&pFile->uiDirtyCacheCount, pFile->uiDirtyCacheCount, (bHighlight = ~bHighlight)); // uiLogCacheCount printHTMLUint( "uiLogCacheCount", "FLMUINT", (void *)pFile, (void *)&pFile->uiLogCacheCount, pFile->uiLogCacheCount, (bHighlight = ~bHighlight)); // pFirstRecord - First Record Cache Block // **Do we need to rework this by passing in the Container, Drn, pFile & LowTransId? ** // if (pFile->pFirstRecord) { f_sprintf( (char *)szTemp, "%s/RCache?Container=%lu?DRN=%lu?File=%s?Version=%lu", m_pszURLString, pDataStruct->FirstRecordContainer, pDataStruct->FirstRecordDrn, szFFileAddress, pDataStruct->FirstRecordLowTransId); } printHTMLLink( "pFirstRecord", "RCACHE_p", (void *)pFile, (void *)&pFile->pFirstRecord, (void *)pFile->pFirstRecord, (char *)szTemp, (bHighlight = ~bHighlight)); // pLastRecord - Last Record Cache Block if (pFile->pLastRecord) { f_sprintf( (char *)szTemp, "%s/RCache?Container=%lu?DRN=%lu?File=%s?Version=%lu", m_pszURLString, pDataStruct->LastRecordContainer, pDataStruct->LastRecordDrn, szFFileAddress, pDataStruct->LastRecordLowTransId); } printHTMLLink( "pLastRecord", "RCACHE_p", (void *)pFile, (void *)&pFile->pLastRecord, (void *)pFile->pLastRecord, (char *)szTemp, (bHighlight = ~bHighlight)); // ppBlocksDone - List of blocks to be written to the Rollback if (pFile->ppBlocksDone) { f_sprintf( (char *)szTemp, "%s/SCache?From=FFile?Link=ppBlocksDone?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "ppBlocksDone", "SCACHE **", (void *)pFile, (void *)&pFile->ppBlocksDone, (void *)pFile->ppBlocksDone, (char *)szTemp, (bHighlight = ~bHighlight)); // uiBlocksDoneArraySize printHTMLUint( "uiBlocksDoneArraySize", "FLMUINT", (void *)pFile, (void *)&pFile->uiBlocksDoneArraySize, pFile->uiBlocksDoneArraySize, (bHighlight = ~bHighlight)); // uiBlocksDone - Number of Blocks in Blocks Done Array printHTMLUint( "uiBlocksDone", "FLMUINT", (void *)pFile, (void *)&pFile->uiBlocksDone, pFile->uiBlocksDone, (bHighlight = ~bHighlight)); // pTransLogList - Shared Cache Log List if (pFile->pTransLogList != NULL) { f_sprintf( (char *)szTemp, "%s/SCache?From=FFile?Link=pTransLogList?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pTransLogList", "SCACHE *", (void *)pFile, (void *)&pFile->pTransLogList, (void *)pFile->pTransLogList, (char *)szTemp, (bHighlight = ~bHighlight)); // pOpenNotifies - Open Notifies Threads if (pFile->pOpenNotifies != NULL) { f_sprintf( (char *)szTemp, "%s/FNOTIFY?From=FFile?Link=pOpenNotifies?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pOpenNotifies", "FNOTIFY *", (void *)pFile, (void *)&pFile->pOpenNotifies, (void *)pFile->pOpenNotifies, (char *)szTemp, (bHighlight = ~bHighlight)); // pCloseNotifies if (pFile->pCloseNotifies != NULL) { f_sprintf( (char *)szTemp, "%s/FNOTIFY?From=FFile?Link=pCloseNotifies?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pCloseNotifies", "FNOTIFY *", (void *)pFile, (void *)&pFile->pCloseNotifies, (void *)pFile->pCloseNotifies, (char *)szTemp, (bHighlight = ~bHighlight)); // pDictList - Dictionaries List if (pFile->pDictList != NULL) { f_sprintf( (char *)szTemp, "%s/FDICT?From=FFile?Link=pDictList?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pDictList", "FDICT *", (void *)pFile, (void *)&pFile->pDictList, (void *)pFile->pDictList, (char *)szTemp, (bHighlight = ~bHighlight)); // krefPool - Kref pool printAddress( &pFile->krefPool, szAddress); printHTMLString( "krefPool", "POOL", (void *)pFile, (void *)&pFile->krefPool, (char *)szAddress, (bHighlight = ~bHighlight)); // FileHdr - File Header f_sprintf( (char *)szTemp, "%s/FILE_HDR?From=FFile?Link=FileHdr?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); printHTMLLink( "FileHdr", "FILE_HDR", (void *)pFile, (void *)&pFile->FileHdr, (void *)&pFile->FileHdr, (char *)szTemp, (bHighlight = ~bHighlight)); // uiMaxFileSize - Maximum File Size printHTMLUint( "uiMaxFileSize", "FLMUINT", (void *)pFile, (void *)&pFile->uiMaxFileSize, pFile->uiMaxFileSize, (bHighlight = ~bHighlight)); // uiFileExtendSize - File Extend Size printHTMLUint( "uiFileExtendSize", "FLMUINT", (void *)pFile, (void *)&pFile->uiFileExtendSize, pFile->uiFileExtendSize, (bHighlight = ~bHighlight)); // uiUpdateTransID - Update Transaction Id printHTMLUint( "uiUpdateTransID", "FLMUINT", (void *)pFile, (void *)&pFile->uiUpdateTransID, pFile->uiUpdateTransID, (bHighlight = ~bHighlight)); // pRfl - Roll Forward Log Object if (pFile->pRfl) { f_sprintf( (char *)szTemp, "%s/Rfl?From=FFile?Link=pRfl?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pRfl", "F_Rfl *", (void *)pFile, (void *)&pFile->pRfl, (void *)pFile->pRfl, (char *)szTemp, (bHighlight = ~bHighlight)); // ucLastCommittedLogHdr - Last Committed Log Header f_sprintf( (char *)szTemp, "%s/LogHdr?From=FFile?" "Link=ucLastCommittedLogHdr?" "Address=%s?Bucket=%ld", m_pszURLString, szFFileAddress, pFile->uiBucket); printHTMLLink( "ucLastCommittedLogHdr", "FLMBYTE", (void *)pFile, (void *)&pFile->ucLastCommittedLogHdr[0], (void *)&pFile->ucLastCommittedLogHdr[0], (char *)szTemp, (bHighlight = ~bHighlight)); // ucCheckpointLogHdr - Checkpoint Log Header f_sprintf( (char *)szTemp, "%s/LogHdr?From=FFile?" "Link=ucCheckpointLogHdr?" "Address=%s?Bucket=%ld", m_pszURLString, szFFileAddress, pFile->uiBucket); printHTMLLink( "ucCheckpointLogHdr", "FLMBYTE", (void *)pFile, (void *)&pFile->ucCheckpointLogHdr[0], (void *)&pFile->ucCheckpointLogHdr[0], (char *)szTemp, (bHighlight = ~bHighlight)); // ucUncommittedLogHdr - Uncommitted Log Header f_sprintf( (char *)szTemp, "%s/LogHdr?From=FFile?Link=ucUncommittedLogHdr?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); printHTMLLink( "ucUncommittedLogHdr", "FLMBYTE", (void *)pFile, (void *)&pFile->ucUncommittedLogHdr[0], (void *)&pFile->ucUncommittedLogHdr[0], (char *)szTemp, (bHighlight = ~bHighlight)); // pBufferMgr f_sprintf( (char *)szTemp, "%s/F_IOBufferMgr?From=FFile?" "Link=pBufferMgr?" "Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); printHTMLLink( "pBufferMgr", "F_IOBufferMgr *", (void *)pFile, (void *)&pFile->pBufferMgr, (void *)pFile->pBufferMgr, (char *)szTemp, (bHighlight = ~bHighlight)); // pCurrLogBuffer f_sprintf( (char *)szTemp, "%s/F_IOBuffer?From=FFile?" "Link=pCurrLogBuffer?" "Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); printHTMLLink( "pCurrLogBuffer", "F_IOBuffer *", (void *)pFile, (void *)&pFile->pCurrLogBuffer, (void *)pFile->pCurrLogBuffer, (char *)szTemp, (bHighlight = ~bHighlight)); // uiCurrLogWriteOffset printHTMLUint( "uiCurrLogWriteOffset", "FLMUINT", (void *)pFile, (void *)&pFile->uiCurrLogWriteOffset, pFile->uiCurrLogWriteOffset, (bHighlight = ~bHighlight)); // uiCurrLogBlkAddr printHTMLUint( "uiCurrLogBlkAddr", "FLMUINT", (void *)pFile, (void *)&pFile->uiCurrLogBlkAddr, pFile->uiCurrLogBlkAddr, (bHighlight = ~bHighlight)); // pFileLockObj - File Locking Object if (pFile->pFileLockObj) { f_sprintf( (char *)szTemp, "%s/ServerLockObject?From=FFile?" "Link=pFileLockObj?" "Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pFileLockObj", "ServerLockObject_p", (void *)pFile, (void *)&pFile->pFileLockObj, (void *)pFile->pFileLockObj, (char *)szTemp, (bHighlight = ~bHighlight)); // pWriteLockObj if (pFile->pWriteLockObj) { f_sprintf( (char *)szTemp, "%s/ServerLockObject?From=FFile?" "Link=pWriteLockObj?" "Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pWriteLockObj", "ServerLockObject_p", (void *)pFile, (void *)&pFile->pWriteLockObj, (void *)pFile->pWriteLockObj, (char *)szTemp, (bHighlight = ~bHighlight)); // pLockFileHdl - File Lock Handle (3.x Db) if (pFile->pLockFileHdl) { f_sprintf( (char *)szTemp, "%s/F_FileHdl?From=FFile?" "Link=pLockFileHdl?" "Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pLockFileHdl", "F_FileHdl_p", (void *)pFile, (void *)&pFile->pLockFileHdl, (void *)pFile->pLockFileHdl, (char *)szTemp, (bHighlight = ~bHighlight)); // pLockNotifies - Notifies List if (pFile->pLockNotifies) { f_sprintf( (char *)szTemp, "%s/FNOTIFY?From=FFile?" "Link=pLockNotifies?" "Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pLockNotifies", "FNOTIFY *", (void *)pFile, (void *)&pFile->pLockNotifies, (void *)pFile->pLockNotifies, (char *)szTemp, (bHighlight = ~bHighlight)); // bBeingLocked - File being locked printHTMLString( "bBeingLocked", "FLMBOOL", (void *)pFile, (void *)&pFile->bBeingLocked, (char *)(pFile->bBeingLocked ? "Yes" : "No"), (bHighlight = ~bHighlight)); // pFirstReadTrans - First Read Transaction if (pFile->pFirstReadTrans) { char szFDBAddr[20]; printAddress( pFile->pFirstReadTrans, szAddress); f_sprintf( szFDBAddr, "%s", szAddress); f_sprintf( (char *)szTemp, "%s/FDB?FFileAddress=%s?Bucket=%lu?FDBAddress=%s", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket, szFDBAddr); } printHTMLLink( "pFirstReadTrans", "FDB *", (void *)pFile, (void *)&pFile->pFirstReadTrans, (void *)pFile->pFirstReadTrans, (char *)szTemp, (bHighlight = ~bHighlight)); // pLastReadTrans - Last Read Transaction if (pFile->pLastReadTrans) { char szFDBAddr[20]; printAddress( pFile->pLastReadTrans, szAddress); f_sprintf( szFDBAddr, "%s", szAddress); f_sprintf( (char *)szTemp, "%s/FDB?FFileAddress=%s?Bucket=%lu?FDBAddress=%s", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket, szFDBAddr); } printHTMLLink( "pLastReadTrans", "FDB *", (void *)pFile, (void *)&pFile->pLastReadTrans, (void *)pFile->pLastReadTrans, (char *)szTemp, (bHighlight = ~bHighlight)); // pFirstKilledTrans - First Killed Transaction if (pFile->pFirstKilledTrans) { char szFDBAddr[20]; printAddress( pFile->pFirstKilledTrans, szAddress); f_sprintf( szFDBAddr, "%s", szAddress); f_sprintf( (char *)szTemp, "%s/FDB?FFileAddress=%s?Bucket=%lu?FDBAddress=%s", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket, szFDBAddr); } printHTMLLink( "pFirstKilledTrans", "FDB *", (void *)pFile, (void *)&pFile->pFirstKilledTrans, (void *)pFile->pFirstKilledTrans, (char *)szTemp, (bHighlight = ~bHighlight)); // uiFirstLogBlkAddress printHTMLUint( "uiFirstLogBlkAddress", "FLMUINT", (void *)pFile, (void *)&pFile->uiFirstLogBlkAddress, pFile->uiFirstLogBlkAddress, (bHighlight = ~bHighlight)); // uiFirstLogCPBlkAddress - First Log Checkpoint Block Address printHTMLUint( "uiFirstLogCPBlkAddress", "FLMUINT", (void *)pFile, (void *)&pFile->uiFirstLogCPBlkAddress, pFile->uiFirstLogCPBlkAddress, (bHighlight = ~bHighlight)); // uiLastCheckpointTime - Last Checkpoint Time FormatTime( pFile->uiLastCheckpointTime, szFormattedTime); printHTMLString( "uiLastCheckpointTime", "FLMUINT", (void *)pFile, (void *)&pFile->uiLastCheckpointTime, (char *)szFormattedTime, (bHighlight = ~bHighlight)); // pCPThrd if (pFile->pCPThrd) { f_sprintf( (char *)szTemp, "%s/F_Thread?From=FFile?" "Link=pCPThrd?" "Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pCPThrd", "F_Thread *", (void *)pFile, (void *)&pFile->pCPThrd, (void *)pFile->pCPThrd, (char *)szTemp, (bHighlight = ~bHighlight)); // pCPInfo - Checkpoint Info Buffer if (pFile->pCPInfo) { f_sprintf( (char *)szTemp, "%s/CP_INFO?From=FFile?Link=pCPInfo?Address=%s?Bucket=%lu", m_pszURLString, szFFileAddress, (unsigned long)pFile->uiBucket); } printHTMLLink( "pCPInfo", "CP_INFO_p", (void *)pFile, (void *)&pFile->pCPInfo, (void *)pFile->pCPInfo, (char *)szTemp, (bHighlight = ~bHighlight)); // CheckpointRc - Last Checkpoint Return Code printHTMLUint( "CheckpointRc", "FLMUINT", (void *)pFile, (void *)&pFile->CheckpointRc, pFile->CheckpointRc, (bHighlight = ~bHighlight)); // uiBucket - Hash Table Bucket printHTMLUint( "uiBucket", "FLMUINT", (void *)pFile, (void *)&pFile->uiBucket, pFile->uiBucket, (bHighlight = ~bHighlight)); // uiFlags - Flags if (pFile->uiFlags) { FLMBOOL bTest = FALSE; char * pTemp = (char *)szTemp; f_sprintf( (char *)szTemp, "%08X<br>", (unsigned)pFile->uiFlags); pTemp += 12; if (pFile->uiFlags & DBF_BEING_OPENED) { f_sprintf(pTemp, "Being Opened"); pTemp += f_strlen("Being Opened"); bTest=TRUE; } if (pFile->uiFlags & DBF_IN_NU_LIST) { if (bTest) { f_sprintf(pTemp, "<br>"); pTemp += f_strlen("<br>"); } f_sprintf(pTemp, "In Not Used List"); pTemp += f_strlen("In Not Used List"); bTest = TRUE; } if (pFile->uiFlags & DBF_BEING_CLOSED) { if (bTest) { f_sprintf(pTemp, "<br>"); pTemp += f_strlen("<br>"); } f_sprintf(pTemp, "Being Closed"); pTemp += f_strlen("Being Closed"); } } else { f_sprintf( (char *)szTemp, "%08X<br>Normal", (unsigned)pFile->uiFlags); } printHTMLString( "uiFlags", "FLMUINT", (void *)pFile, (void *)&pFile->uiFlags, (char *)szTemp, (bHighlight = ~bHighlight)); // bBackupActive - Backup Active printHTMLString( "bBackupActive", "FLMBOOL", (void *)pFile, (void *)&pFile->bBackupActive, (char *)(pFile->bBackupActive ? "Yes" : "No"), (bHighlight = ~bHighlight)); printTableEnd(); } }
int main(int argc, char *argv[]) { (void)argc; // we don't use argc, causes compiler not to warn us about it. // The output of this program may change over a series of runs due to: // https://en.wikipedia.org/wiki/Address_space_layout_randomization int i = 10; char *str1 = "hello world"; // string literals are stored in the text region of memory, not on the heap. char str2[] = "hello world"; // stored on stack // highest addresses contain memory used by the OS: printAddress("getenv", getenv("PATH")); printAddress("argv", argv); // The stack grows downward (the first address below is higher than the second address) printAddress("&i inside main (stack)", &i); addStack(); printAddress("str2 inside main (stack)", str2); // String literals are stored in the .text section of memory (at the bottom of the stack) printAddress("str1 inside main (text)", str1); /* malloc() usually uses the heap to allocate memory. It does so by calling sbrk() to move the "program break" which is the top of the heap. Moving the "program break" to a higher value will give your process more memory. malloc() does this for you. If change the program break with sbrk(), you might break other functions that actually use malloc(). */ printAddress("sbrk (heap)", sbrk(0)); void *m = malloc(1024); printAddress("m (heap)", m); // NOTE: malloc() may use a few bytes for its own bookkeeping, printAddress("sbrk after malloc (heap)", sbrk(0)); free(m); // free()'ing memory doesn't necessarily move sbrk back down. printAddress("sbrk after free (heap)", sbrk(0)); // instead, memory might be reused for future malloc()'s: m = malloc(10); void *m2 = malloc(100); printAddress("m (heap)", m); printAddress("m2 (heap)", m2); printAddress("sbrk after 2 more mallocs (heap)", sbrk(0)); free(m); free(m2); /* malloc() uses mmap() when large areas of space are requested. */ m = malloc(1024*128*50); // typically mmap is used for allocations larger than 128k printAddress("m (that may have been allocated with mmap) (mmap)", m); printAddress("sbrk after malloc (that may use mmap) (heap)", sbrk(0)); free(m); printAddress("globalVar (text)", &globalVar); printAddress("printAddress (text)", printAddress); // since we dynamically link to printf, its isn't defined until // the linker links this program to libc at runtime. The address // that is printed out is the address of the PLT for // printf---which will then in-turn call printf(). printAddress("printf PLT (text)", printf); return EXIT_SUCCESS; }
/**************************************************************************** Desc: Prints the web page for an SCACHE struct ****************************************************************************/ RCODE F_SCacheBlockPage::display( FLMUINT uiNumParams, const char ** ppszParams) { RCODE rc = FERR_OK; FLMUINT uiBlkAddress = 0; FLMUINT uiLowTransID = 0; FLMUINT uiHighTransID = 0; FFILE * pFile; FLMBOOL bHighlight = FALSE; char * pszTemp = NULL; char * pszTemp1 = NULL; FLMUINT uiLoop = 0; char szOffsetTable[10][6]; char szAddressTable[4][20]; SCACHE LocalSCacheBlock; FLMUINT uiPFileBucket = 0; char * pszSCacheRequestString[8] = {0, 0, 0, 0, 0, 0, 0, 0}; char * pszSCacheDataRequest = NULL; char * pszSCacheAutoRequest = NULL; char * pszSCacheUseListRequest = NULL; char * pszSCacheNotifyListRequest = NULL; char * pszFFileRequest = NULL; char * pszFlagNames = NULL; if( RC_BAD( rc = f_alloc( 200, &pszTemp))) { printErrorPage( rc, TRUE, (char *)"Failed to allocate temporary buffer"); goto Exit; } if( RC_BAD( rc = f_alloc( 200, &pszTemp1))) { printErrorPage( rc, TRUE, (char *)"Failed to allocate temporary buffer"); goto Exit; } // Allocate memory for all those string pointers we declared above... for (uiLoop = 0; uiLoop < 8; uiLoop++) { if( RC_BAD( rc = f_alloc( 150, &pszSCacheRequestString[ uiLoop]))) { goto Exit; } } if( RC_BAD( rc = f_alloc( 150, &pszSCacheDataRequest))) { goto Exit; } if( RC_BAD( rc = f_alloc( 150, &pszSCacheAutoRequest))) { goto Exit; } if( RC_BAD( rc = f_alloc( 150, &pszSCacheUseListRequest))) { goto Exit; } if( RC_BAD( rc = f_alloc( 150, &pszSCacheNotifyListRequest))) { goto Exit; } if( RC_BAD( rc = f_alloc( 100, &pszFFileRequest))) { goto Exit; } if( RC_BAD( rc = f_alloc( 100, &pszFlagNames))) { goto Exit; } f_mutexLock( gv_FlmSysData.hShareMutex); rc = locateSCacheBlock( uiNumParams, ppszParams, &LocalSCacheBlock, &uiBlkAddress, &uiLowTransID, &uiHighTransID, &pFile); if (RC_OK(rc) && LocalSCacheBlock.pFile) { uiPFileBucket = LocalSCacheBlock.pFile->uiBucket; } if (RC_OK( rc)) { // Build the proper strings to request various other SCache blocks flmBuildSCacheBlockString( pszSCacheRequestString[0], LocalSCacheBlock.pPrevInFile); flmBuildSCacheBlockString( pszSCacheRequestString[1], LocalSCacheBlock.pNextInFile); flmBuildSCacheBlockString( pszSCacheRequestString[2], LocalSCacheBlock.pPrevInGlobalList); flmBuildSCacheBlockString( pszSCacheRequestString[3], LocalSCacheBlock.pNextInGlobalList); flmBuildSCacheBlockString( pszSCacheRequestString[4], LocalSCacheBlock.pPrevInHashBucket); flmBuildSCacheBlockString( pszSCacheRequestString[5], LocalSCacheBlock.pNextInHashBucket); flmBuildSCacheBlockString( pszSCacheRequestString[6], LocalSCacheBlock.pPrevInVersionList); flmBuildSCacheBlockString( pszSCacheRequestString[7], LocalSCacheBlock.pNextInVersionList); // Build the proper string to request the current Page flmBuildSCacheBlockString( pszSCacheAutoRequest, &LocalSCacheBlock); } f_mutexUnlock( gv_FlmSysData.hShareMutex); if (RC_BAD( rc)) { if (rc == FERR_NOT_FOUND) { // The block wasn't there, print an error message and exit notFoundErr(); rc = FERR_OK; } else if (rc == FERR_MEM) { // Parameters were too long to store in the space provided. // Probably means that the URL was malformed... malformedUrlErr(); rc = FERR_OK; } goto Exit; } //Build the proper string to request this block's data... printAddress( pFile, szAddressTable[0]); f_sprintf( (char *)pszSCacheDataRequest, "%s/SCacheData?BlockAddress=%lu&File=%s&LowTransID=%lu&HighTransID=%lu", m_pszURLString, LocalSCacheBlock.uiBlkAddress, szAddressTable[0], uiLowTransID, uiHighTransID); #ifdef FLM_DEBUG //Build the proper string to request this block's use list if( LocalSCacheBlock.pUseList) { f_sprintf( (char *)pszSCacheUseListRequest, "%s/SCacheUseList?BlockAddress=%lu&File=%s&LowTransID=%lu&HighTransID=%lu", m_pszURLString, LocalSCacheBlock.uiBlkAddress, szAddressTable[0], uiLowTransID, uiHighTransID); } else { pszSCacheUseListRequest[0] = '\0'; } #endif //Build the proper string to request the notify list data... if (LocalSCacheBlock.pNotifyList) { f_sprintf( (char *)pszSCacheNotifyListRequest, "%s/SCacheNotifyList?BlockAddress=%lu&File=%s&LowTransID=%lu&HighTransID=%lu", m_pszURLString, LocalSCacheBlock.uiBlkAddress, szAddressTable[0], uiLowTransID, uiHighTransID); } else { pszSCacheNotifyListRequest[0] = '\0'; } //Build the proper string to request the FFile printAddress( LocalSCacheBlock.pFile, szAddressTable[0]); f_sprintf( (char *)pszFFileRequest, "%s/FFile?From=SCacheBlock&Bucket=%lu&Address=%s", m_pszURLString, uiPFileBucket, szAddressTable[0]); // Build a string with the names of all the flags that have been set... pszFlagNames[0]='\0'; if (LocalSCacheBlock.ui16Flags & CA_DIRTY) { f_strcat( pszFlagNames, "<BR> CA_DIRTY"); } if (LocalSCacheBlock.ui16Flags & CA_READ_PENDING) { f_strcat( pszFlagNames, "<BR> CA_READ_PENDING"); } if (LocalSCacheBlock.ui16Flags & CA_WRITE_TO_LOG) { f_strcat( pszFlagNames, "<BR> CA_WRITE_TO_LOG"); } if (LocalSCacheBlock.ui16Flags & CA_LOG_FOR_CP) { f_strcat( pszFlagNames, "<BR> CA_LOG_FOR_CP"); } if (LocalSCacheBlock.ui16Flags & CA_WAS_DIRTY) { f_strcat( pszFlagNames, "<BR> CA_WAS_DIRTY"); } if (LocalSCacheBlock.ui16Flags & CA_WRITE_PENDING) { f_strcat( pszFlagNames, "<BR> CA_WRITE_PENDING"); } if (LocalSCacheBlock.ui16Flags & CA_IN_WRITE_PENDING_LIST) { f_strcat( pszFlagNames, "<BR> CA_IN_WRITE_PENDING_LIST"); } // OK - Start outputting HTML... stdHdr(); fnPrintf( m_pHRequest, HTML_DOCTYPE "<html>\n"); // Determine if we are being requested to refresh this page or not. if (DetectParameter( uiNumParams, ppszParams, "Refresh")) { // Send back the page with a refresh command in the header fnPrintf( m_pHRequest, "<HEAD>\n" "<META http-equiv=\"refresh\" content=\"5; url=\"%s\">" "<TITLE>SCache Block</TITLE>\n", pszSCacheAutoRequest); printStyle(); popupFrame(); //Spits out a Javascript function that will open a new window.. fnPrintf( m_pHRequest, "</HEAD>\n<body>\n"); f_sprintf( (char*)pszTemp, "<A HREF=\"%s\">Stop Auto-refresh</A>", pszSCacheAutoRequest); } else { // Send back a page without the refresh command fnPrintf( m_pHRequest, "<HEAD>\n"); printStyle(); popupFrame(); //Spits out a Javascript function that will open a new window.. fnPrintf( m_pHRequest, "</HEAD>\n<body>\n"); f_sprintf( (char *)pszTemp, "<A HREF=\"%s?Refresh\">Start Auto-refresh (5 sec.)</A>", pszSCacheAutoRequest); } // Write out the table headings printTableStart( "SCache Block Structure", 4, 100); printTableRowStart(); printColumnHeading( "", JUSTIFY_LEFT, FLM_IMON_COLOR_PUTTY_1, 4, 1, FALSE); fnPrintf( m_pHRequest, "<A HREF=\"%s\">Refresh</A>, %s\n", pszSCacheAutoRequest, pszTemp); printColumnHeadingClose(); printTableRowEnd(); // Write out the table headings. printTableRowStart(); printColumnHeading( "Byte Offset (hex)"); printColumnHeading( "Field Name"); printColumnHeading( "Field Type"); printColumnHeading( "Value"); printTableRowEnd(); // Print the two rows for pPrevInFile and pNextInFile printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[0], "pPrevInFile", &LocalSCacheBlock, &LocalSCacheBlock.pPrevInFile); printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[1], "pNextInFile", &LocalSCacheBlock, &LocalSCacheBlock.pNextInFile); // Format the strings that are displayed in the Offset and Address // columns of the table printOffset( &LocalSCacheBlock, &LocalSCacheBlock.pucBlk, szOffsetTable[0]); printOffset( &LocalSCacheBlock, &LocalSCacheBlock.pFile, szOffsetTable[1]); printOffset( &LocalSCacheBlock, &LocalSCacheBlock.uiBlkAddress, szOffsetTable[2]); printOffset( &LocalSCacheBlock, &LocalSCacheBlock.pNotifyList, szOffsetTable[3]); printOffset( &LocalSCacheBlock, &LocalSCacheBlock.uiHighTransID, szOffsetTable[4]); printOffset( &LocalSCacheBlock, &LocalSCacheBlock.uiUseCount, szOffsetTable[5]); printOffset( &LocalSCacheBlock, &LocalSCacheBlock.ui16Flags, szOffsetTable[6]); printOffset( &LocalSCacheBlock, &LocalSCacheBlock.ui16BlkSize, szOffsetTable[7]); #ifdef FLM_DEBUG printOffset( &LocalSCacheBlock, &LocalSCacheBlock.uiChecksum, szOffsetTable[8]); printOffset( &LocalSCacheBlock, &LocalSCacheBlock.pUseList, szOffsetTable[9]); #endif printAddress( LocalSCacheBlock.pucBlk, szAddressTable[0]); printAddress( LocalSCacheBlock.pFile, szAddressTable[1]); printAddress( LocalSCacheBlock.pNotifyList, szAddressTable[2]); #ifdef FLM_DEBUG printAddress( LocalSCacheBlock.pUseList, szAddressTable[3]); #endif printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td><A HREF=\"javascript:openPopup('%s')\">pucBlk</A></td>\n" "<td>FLMBYTE *</td>\n<td><A HREF=\"javascript:openPopup('%s')\">%s</A></td>\n", szOffsetTable[0], pszSCacheDataRequest, pszSCacheDataRequest, szAddressTable[0] ); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td><A href=%s>pFile</A></td>\n" "<td>FFILE *</td>\n<td><A HREF=%s>%s</a></td>\n", szOffsetTable[1], pszFFileRequest, pszFFileRequest, szAddressTable[1]); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiBlkAddress</td>\n<td>FLMUINT</td>\n" "<td>0x%lX</td>\n", szOffsetTable[2], LocalSCacheBlock.uiBlkAddress); printTableRowEnd(); //Print the rows for the remaining SCache * fields printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[2], "pPrevInGlobalList", &LocalSCacheBlock, &LocalSCacheBlock.pPrevInGlobalList); printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[3], "pNextInGlobalList", &LocalSCacheBlock, &LocalSCacheBlock.pNextInGlobalList); printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[4], "pPrevInHashBucket", &LocalSCacheBlock, &LocalSCacheBlock.pPrevInHashBucket); printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[5], "pNextInHashBucket", &LocalSCacheBlock, &LocalSCacheBlock.pNextInHashBucket); printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[6], "pPrevInVersionList", &LocalSCacheBlock, &LocalSCacheBlock.pPrevInVersionList); printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[7], "pNextInVersionList", &LocalSCacheBlock, &LocalSCacheBlock.pNextInVersionList); //Notify list line printTableRowStart( bHighlight = ~bHighlight); if (LocalSCacheBlock.pNotifyList) { fnPrintf( m_pHRequest, TD_s " <td> <A HREF=\"javascript:openPopup('%s')\"> pNotifyList </A> </td> <td>FNOTIFY *</td> " "<td> <A HREF=\"javascript:openPopup('%s')\"> %s </A> </td>", szOffsetTable[3], pszSCacheNotifyListRequest, pszSCacheNotifyListRequest, szAddressTable[2]); } else { fnPrintf( m_pHRequest, TD_s " <td> pNotifyList </td> <td>FNOTIFY *</td> " "<td> 0x0 </td>", szOffsetTable[3]); } printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiHighTransID</td>\n" "<td>FLMUINT</td>\n" TD_8x, szOffsetTable[4], LocalSCacheBlock.uiHighTransID); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiUseCount</td>\n<td>FLMUINT</td>\n" TD_lu, szOffsetTable[5], LocalSCacheBlock.uiUseCount); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>ui16Flags</td>\n<td>FLMUINT16</td>\n" "<td>0x%04X %s</td>\n", szOffsetTable[6], LocalSCacheBlock.ui16Flags, pszFlagNames); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>ui16BlkSize</td>\n<td>FLMUINT16</td>\n" TD_i, szOffsetTable[7], LocalSCacheBlock.ui16BlkSize); printTableRowEnd(); #ifdef FLM_DEBUG printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiChecksum</td>\n" "<td>FLMUINT</td>\n" TD_8x, szOffsetTable[8], LocalSCacheBlock.uiChecksum); printTableRowEnd(); #endif #ifdef FLM_DEBUG //Last line - the use list... printTableRowStart( bHighlight = ~bHighlight); if (LocalSCacheBlock.pUseList) { fnPrintf( m_pHRequest, TD_s " <td> <A href=\"javascript:openPopup('%s')> pUseList </A> </td> <td> SCACHE_USE_p </td> <td> <A href=\"javascript:openPopup('%s')> %s </A></td>", szOffsetTable[9], pszSCacheUseListRequest, pszSCacheUseListRequest, szAddressTable[3]); } else { fnPrintf( m_pHRequest, TD_s " <td> pUseList </td> <td> SCACHE_USE_p </td> <td> 0x0 </td>", szOffsetTable[9]); } printTableRowEnd(); #endif fnPrintf( m_pHRequest, TABLE_END "</BODY></HTML>\n"); fnEmit(); Exit: // Even though uiLoop2 is not in the same scope as uiLoop, VC6 still // complains if this is called uiLoop.... for (FLMUINT uiLoop2 = 0; uiLoop2 < 8; uiLoop2++) { if (pszSCacheRequestString[uiLoop2]) { f_free( &pszSCacheRequestString[uiLoop2]); } } if (pszSCacheDataRequest) { f_free( &pszSCacheDataRequest); } if (pszSCacheAutoRequest) { f_free( &pszSCacheAutoRequest); } if (pszSCacheUseListRequest) { f_free( &pszSCacheUseListRequest); } if (pszSCacheNotifyListRequest) { f_free( &pszSCacheNotifyListRequest); } if( pszFFileRequest) { f_free( &pszFFileRequest); } if( pszFlagNames) { f_free( &pszFlagNames); } if (pszTemp) { f_free( &pszTemp); } if (pszTemp1) { f_free( &pszTemp1); } return( rc); }
/**************************************************************************** Desc: Prints the web page for an SCACHEMGR struct (The URL for this page requires no parameters since there is only one SCACHE_MGR per copy of FLAIM.) ****************************************************************************/ RCODE F_SCacheMgrPage::display( FLMUINT uiNumParams, const char ** ppszParams) { RCODE rc = FERR_OK; SCACHE_MGR LocalSCacheMgr; FLMBOOL bAutoRefresh; #define NUM_CACHE_REQ_STRINGS 4 char * pszSCacheRequestString[ NUM_CACHE_REQ_STRINGS]; char szOffsetTable[12][6]; char szAddressTable[2][20]; FLMBOOL bHighlight = FALSE; char * pszTemp = NULL; FLMUINT uiLoop; // Note: The SCacheBlock requests need the following params: // "BlockAddress", "File", "LowTransID" and "HighTransID" // ex: <A href="SCacheBlock?BlockAddress=100?File=5?LowTransID=30?HighTransID=100"> pMRUCache </A> if( RC_BAD( rc = f_alloc( 200, &pszTemp))) { printErrorPage( rc, TRUE, (char *)"Failed to allocate temporary buffer"); goto Exit; } // First thing that we need to do is grab a local copy of gv_FlmSysData.SCacheMgr, // and of the data for the three SCache blocks that it has pointers to... for (uiLoop = 0; uiLoop < NUM_CACHE_REQ_STRINGS; uiLoop++) { if( RC_BAD( rc = f_alloc( 150, &pszSCacheRequestString[ uiLoop]))) { printErrorPage( rc, TRUE, (char *)"Failed to allocate temporary buffer"); goto Exit; } } f_mutexLock( gv_FlmSysData.hShareMutex); f_memcpy (&LocalSCacheMgr, &gv_FlmSysData.SCacheMgr, sizeof (LocalSCacheMgr)); flmBuildSCacheBlockString( pszSCacheRequestString[0], LocalSCacheMgr.pMRUCache); flmBuildSCacheBlockString( pszSCacheRequestString[1], LocalSCacheMgr.pLRUCache); flmBuildSCacheBlockString( pszSCacheRequestString[2], LocalSCacheMgr.pFirstFree); flmBuildSCacheBlockString( pszSCacheRequestString[3], LocalSCacheMgr.pLastFree); f_mutexUnlock( gv_FlmSysData.hShareMutex); bAutoRefresh = DetectParameter( uiNumParams, ppszParams, "Refresh"); // Now - are we being asked to display the usage stats? Or is this a regular page... if (DetectParameter( uiNumParams, ppszParams, "Usage")) { // There's a function to handle display the usage info (because both // RCacheMgr and SCacheMgr have usage stats). writeUsage( &LocalSCacheMgr.Usage, bAutoRefresh, "/SCacheMgr?Usage", "Usage Statistics for the SCache"); } else // This is a regular SCacheMgr page... { // Determine if we are being requested to refresh this page or not. stdHdr(); fnPrintf( m_pHRequest, HTML_DOCTYPE "<HTML>\n"); if (bAutoRefresh) { // Send back the page with a refresh command in the header fnPrintf( m_pHRequest, "<HEAD>" "<META http-equiv=\"refresh\" content=\"5; url=%s/SCacheMgr?Refresh\">" "<TITLE>gv_FlmSysData.SCacheMgr</TITLE>\n", m_pszURLString); printStyle(); popupFrame(); //Spits out a Javascript function that will open a new window.. fnPrintf( m_pHRequest, "\n</HEAD>\n<body>\n"); f_sprintf( (char *)pszTemp, "<A HREF=%s/SCacheMgr>Stop Auto-refresh</A>", m_pszURLString); } else // bAutoRefresh == FALSE { // Send back a page without the refresh command fnPrintf( m_pHRequest, "<HEAD>" "<TITLE>gv_FlmSysData.SCacheMgr</TITLE>\n"); printStyle(); popupFrame(); //Spits out a Javascript function that will open a new window.. fnPrintf( m_pHRequest, "\n</HEAD>\n<body>\n"); f_sprintf( (char *)pszTemp, "<A HREF=%s/SCacheMgr?Refresh>Start Auto-refresh (5 sec.)</A>", m_pszURLString); } // Write out the table headings printTableStart( "SCache Manager Structure", 4); printTableRowStart(); printColumnHeading( "", JUSTIFY_LEFT, FLM_IMON_COLOR_PUTTY_1, 4, 1, FALSE); fnPrintf( m_pHRequest, "<A HREF=%s/SCacheMgr>Refresh</A>, %s\n", m_pszURLString, pszTemp); printColumnHeadingClose(); printTableRowEnd(); // Write out the table headings. printTableRowStart(); printColumnHeading( "Byte Offset (hex)"); printColumnHeading( "Field Name"); printColumnHeading( "Field Type"); printColumnHeading( "Value"); printTableRowEnd(); //Now - we have three rows in the table that may or may not have hyperlinks in them. printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[0], "pMRUCache", &LocalSCacheMgr, &LocalSCacheMgr.pMRUCache); printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[1], "pLRUCache", &LocalSCacheMgr, &LocalSCacheMgr.pLRUCache); printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[2], "pFirstFree", &LocalSCacheMgr, &LocalSCacheMgr.pFirstFree); printTableRowStart( bHighlight = ~bHighlight); flmPrintCacheLine(m_pHRequest, pszSCacheRequestString[3], "pLastFree", &LocalSCacheMgr, &LocalSCacheMgr.pLastFree); //Format the strings that are displayed in the Offset column on of the table printOffset(&LocalSCacheMgr, &LocalSCacheMgr.ppHashTbl, szOffsetTable[0]); printOffset(&LocalSCacheMgr, &LocalSCacheMgr.Usage, szOffsetTable[1]); printOffset(&LocalSCacheMgr, &LocalSCacheMgr.bAutoCalcMaxDirty, szOffsetTable[2]); printOffset(&LocalSCacheMgr, &LocalSCacheMgr.uiMaxDirtyCache, szOffsetTable[3]); printOffset(&LocalSCacheMgr, &LocalSCacheMgr.uiLowDirtyCache, szOffsetTable[4]); printOffset(&LocalSCacheMgr, &LocalSCacheMgr.uiTotalUses, szOffsetTable[5]); printOffset(&LocalSCacheMgr, &LocalSCacheMgr.uiBlocksUsed, szOffsetTable[6]); printOffset(&LocalSCacheMgr, &LocalSCacheMgr.uiPendingReads, szOffsetTable[7]); printOffset(&LocalSCacheMgr, &LocalSCacheMgr.uiIoWaits, szOffsetTable[8]); printOffset(&LocalSCacheMgr, &LocalSCacheMgr.uiHashTblSize, szOffsetTable[9]); printOffset(&LocalSCacheMgr, &LocalSCacheMgr.uiHashTblBits, szOffsetTable[10]); #ifdef FLM_DEBUG printOffset(&LocalSCacheMgr, &LocalSCacheMgr.bDebug, szOffsetTable[11]); #endif printAddress( LocalSCacheMgr.ppHashTbl, szAddressTable[0]); printAddress( &LocalSCacheMgr.Usage, szAddressTable[1]); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td><A HREF=\"%s/SCacheHashTable?Start=0\">ppHashTbl</A></td>\n" "<td>SCACHE **</td>\n" "<td><A href=\"%s/SCacheHashTbl\">%s</A></td>\n", szOffsetTable[0], m_pszURLString, m_pszURLString, szAddressTable[0]); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td><A href=\"javascript:openPopup('%s/SCacheMgr?Usage')\">Usage</A></td>\n" "<td>FLM_CACHE_USAGE</td>\n" "<td><A href=\"javascript:openPopup('%s/SCacheMgr?Usage')\">%s</A></td>\n", szOffsetTable[1], m_pszURLString, m_pszURLString, szAddressTable[1]); printTableRowEnd(); // uiFreeCount printHTMLUint( (char *)"uiFreeCount", (char *)"FLMUINT", (void *)&LocalSCacheMgr, (void *)&LocalSCacheMgr.uiFreeCount, LocalSCacheMgr.uiFreeCount, (bHighlight = ~bHighlight)); // uiFreeBytes printHTMLUint( (char *)"uiFreeBytes", (char *)"FLMUINT", (void *)&LocalSCacheMgr, (void *)&LocalSCacheMgr.uiFreeBytes, LocalSCacheMgr.uiFreeBytes, (bHighlight = ~bHighlight)); // uiReplaceableCount printHTMLUint( (char *)"uiReplaceableCount", (char *)"FLMUINT", (void *)&LocalSCacheMgr, (void *)&LocalSCacheMgr.uiReplaceableCount, LocalSCacheMgr.uiReplaceableCount, (bHighlight = ~bHighlight)); // uiReplaceableBytes printHTMLUint( (char *)"uiReplaceableBytes", (char *)"FLMUINT", (void *)&LocalSCacheMgr, (void *)&LocalSCacheMgr.uiReplaceableBytes, LocalSCacheMgr.uiReplaceableBytes, (bHighlight = ~bHighlight)); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>bAutoCalcMaxDirty</td>\n" "<td>FLMBOOL</td>\n" TD_i, szOffsetTable[2], LocalSCacheMgr.bAutoCalcMaxDirty); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiMaxDirtyCache</td>\n" "<td>FLMUINT</td>\n" TD_lu, szOffsetTable[3], LocalSCacheMgr.uiMaxDirtyCache); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiLowDirtyCache</td>\n" "<td>FLMUINT</td>\n" TD_lu, szOffsetTable[4], LocalSCacheMgr.uiLowDirtyCache); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiTotalUses</td>\n" "<td>FLMUINT</td>\n" TD_lu, szOffsetTable[5], LocalSCacheMgr.uiTotalUses); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiBlocksUsed</td> <td>FLMUINT</td>\n" TD_lu, szOffsetTable[6], LocalSCacheMgr.uiBlocksUsed); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiPendingReads</td>\n" "<td>FLMUINT</td>\n" TD_lu, szOffsetTable[7], LocalSCacheMgr.uiPendingReads); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiIoWaits</td>\n <td>FLMUINT</td>\n" TD_lu, szOffsetTable[8], LocalSCacheMgr.uiIoWaits); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiHashTableSize</td>\n" "<td>FLMUINT</td>\n" TD_lu, szOffsetTable[9], LocalSCacheMgr.uiHashTblSize); printTableRowEnd(); printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>uiHashTableBits</td>\n" "<td>FLMUINT</td>\n" TD_lu, szOffsetTable[10], LocalSCacheMgr.uiHashTblBits); printTableRowEnd(); #ifdef FLM_DEBUG printTableRowStart( bHighlight = ~bHighlight); fnPrintf( m_pHRequest, TD_s "<td>bDebug</td>\n" "<td>FLMBOOL</td>\n" TD_i, szOffsetTable[11], LocalSCacheMgr.bDebug); printTableRowEnd(); #endif printTableEnd(); fnPrintf( m_pHRequest, "</BODY></HTML>\n"); fnEmit(); } Exit: if (pszTemp) { f_free( &pszTemp); } for (uiLoop = 0; uiLoop < NUM_CACHE_REQ_STRINGS; uiLoop++) { if( pszSCacheRequestString[uiLoop]) { f_free( &pszSCacheRequestString[uiLoop]); } } return( rc); }
static void printBDXAddrOperand(MCInst *MI, int OpNum, SStream *O) { printAddress(MI, MCOperand_getReg(MCInst_getOperand(MI, OpNum)), MCOperand_getImm(MCInst_getOperand(MI, OpNum + 1)), MCOperand_getReg(MCInst_getOperand(MI, OpNum + 2)), O); }