int main(int argc, char **argv) { auto opts = GetOpts(argc, argv); int start = 1000; int end = 7500; int skip = 500; std::cout << "Classical" << std::endl; for (int N = start; N <= end; N += skip) { SingleBenchmark(N, N, N, CLASSICAL); } std::cout << std::endl; std::cout << "Strassen" << std::endl; for (int N = start; N <= end; N += skip) { SingleBenchmark(N, N, N, STRASSEN); } std::cout << std::endl; std::cout << "Strassen" << std::endl; for (int N = start; N <= end; N += skip) { SingleBenchmark(N, N, N, STRASSEN_SCALED); } std::cout << std::endl; return 0; }
int main(int argc, char **argv) { auto opts = GetOpts(argc, argv); std::vector<int> m_vals; for (int i = 13000; i <= 13000; i += 1000) { m_vals.push_back(i); } if (OptExists(opts, "mkl")) { std::vector<int> num_steps = {0}; BenchmarkSet(m_vals, m_vals, m_vals, num_steps, MKL); } if (OptExists(opts, "strassen")) { //int num_steps = GetIntOpt(opts, "strassen"); std::vector<int> num_steps = {5}; BenchmarkSet(m_vals, m_vals, m_vals, num_steps, STRASSEN); } if (OptExists(opts, "smirnov54")) { std::vector<int> num_steps = {3}; BenchmarkSet(m_vals, m_vals, m_vals, num_steps, SMIRNOV54); } if (OptExists(opts, "schonhage")) { std::vector<int> num_steps = {2}; BenchmarkSet(m_vals, m_vals, m_vals, num_steps, SCHONHAGE333_21_117_APPROX); } return 0; }
int main(int argc, char **argv) { GetOpts(argc, argv, &myId); if (pcmPlaybackInit() < 0) { printf("Failure to initialize sound system, aborting\n"); return -1; } /* pcmPlayHeartBeat(60); sleep(5*60); pcmPlaybackStop(); */ // XXX TODO - read myId from config file hbSource = 0; //myId; hbSocket = initBroadcastSocketListener(HB_PORT); if (hbSocket < 0) { printf("Could not creating hb socket listener (error %d), aborting\n", hbSocket); return -1; } cmdSocket = initBroadcastSocketListener(COMMAND_PORT); if (cmdSocket < 0) { printf("Could not creating command socket listener (error %d), aborting\n", cmdSocket); return -1; } pulseAudioListen(); return 0; }
// [START iot_mqtt_run] int main(int argc, char* argv[]) { // check if running as root checkRoot(); OpenSSL_add_all_algorithms(); OpenSSL_add_all_digests(); OpenSSL_add_all_ciphers(); if (GetOpts(argc, argv)) { Publish(opts.payload, strlen(opts.payload)); } else { Usage(); } EVP_cleanup(); }
/* * Main */ int main(int argc, char* argv[]) { GetOpts(argc, argv); Fork(); SetProcessFlags(); rand_initialize(); DeviceInit(); FdInit(); AttachPrefix("/dev/random", UNIT_RANDOM); AttachPrefix("/dev/urandom", UNIT_URANDOM); HookIrqs(); Daemonize(); return Loop(); }
/***************************************************************************\ * Idso * * !dso StructName [FieldName] [Address] * * 06/17/96 Created Gerardob \***************************************************************************/ BOOL Idso(DWORD opts, LPSTR pszCmdLine) { BOOL fOneField = FALSE; DWORD dwOptions; DWORD dwValue, dwSize, dwBytesRead, dwOffset, dwOffsetNext, dwFieldsPerRow, dwMoveSize; DWORD dwBuffer [20]; /* Make sure it has an even number of elemnts and at least 4*/ const DWORD *pcdwLimit = dwBuffer + (sizeof(dwBuffer) / sizeof(*dwBuffer)); DWORD *pdwValue; LPSTR pszField, pszAddress; PBYTE pBufferOffset; PSTRUCTURESTABLE pst; PSTRUCTUREOFFSETSTABLE psot; PVOID pAddress = NULL; if (pszCmdLine == NULL) { return FALSE; } /* * NULL terminate first argument and get a pointer to * second one (presumably the field name) */ /* * Get the options, if any */ if (*pszCmdLine == '-') { dwOptions = GetOpts(&pszCmdLine, NULL); } /* * Find the struct table */ pszField = dsoTerminateString(pszCmdLine, &dwSize); pst = dosGetStruct (pszCmdLine, dwSize); if (pst == NULL) { Print("Structure not found: %s\n", pszCmdLine); return TRUE; } /* * Got a table */ psot = pst->psot; /* * If there is another argument, let's assume a field name follows */ if (*pszField != 0) { /* * Find the field */ pszAddress = dsoTerminateString(pszField, &dwSize); psot = dosGetField (psot, pszField, dwSize); /* * If it didn't find the field and an address was provided, game over. * Otherwise, the second parameter might be the address */ if (psot == NULL) { if (*pszAddress != 0) { Print("Field not found: %s. Struct: %s\n", pszField, pst->pszName); return TRUE; } else { pszAddress = pszField; /* * Reset psot since this argument was not a field */ psot = pst->psot; } } else { fOneField = TRUE; } /* * Get the pointer to the struct */ if (*pszAddress != 0) { pAddress = EvalExp(pszAddress); if (pAddress == NULL) { /* * EvalExp displayed the error message, so return silently */ return TRUE; } } } /* if (*pszField != 0) */ /* * If a field name was specified, dump that field only * Otherwise, dump the whole table. */ if (fOneField) { /* * If no address available, just display the field name and offset */ dwOffset = dsoGetOffset(psot); Print ("Structure %s - Size: %#lx\n", pst->pszName, pst->dwSize); Print("Field: %s - Offset: %#lx\n", psot->pszField, dwOffset); if (pAddress == NULL) { return TRUE; } /* * Printing field value */ /*123456789 1*/ Print("Address Value\n"); dwBytesRead = 0; dwSize = dsoGetSize(psot, dwOffset); /* * Print 4 DWORDS per row; one row per loop */ do { /* while ((int)dwSize > 0) */ /* * Read values for next row */ if (4 * sizeof(DWORD) >= dwSize) { dwMoveSize = dwSize; } else { dwMoveSize = 4 * sizeof(DWORD); } moveBlock(dwBuffer, (PBYTE)pAddress + dwOffset + dwBytesRead, dwMoveSize); pBufferOffset = (PBYTE)dwBuffer; /* * Print the address */ Print("%08lx ", (DWORD)((PBYTE)pAddress + dwOffset + dwBytesRead)); /* * Keep track of bytes read (dwBytesRead) and bytes * remaining to be read (dwSize) */ dwBytesRead += dwMoveSize; dwSize -= dwMoveSize; /* * Print the values, one dword at the time */ while (dwMoveSize >= sizeof(DWORD)) { Print("%08lx ", *((DWORD *)pBufferOffset)); pBufferOffset += sizeof(DWORD); dwMoveSize -= sizeof(DWORD); } /* * If less than a DWORD left, zero extend and print a DWORD */ if (dwMoveSize > 0) { dwValue = 0; memcpy(&dwValue, pBufferOffset, dwMoveSize); Print("%0*lx", dwMoveSize * 2, dwValue); } Print("\n"); } while ((int)dwSize > 0); return TRUE; } /* if (fOneField) */ /* * Printing all the fields. */ Print ("Structure %s - Size: %#lx\n", pst->pszName, pst->dwSize); dwOffset = 0; pBufferOffset = NULL; /* Forces the local buffer to be loaded */ dwFieldsPerRow = 0; /* * Loop through all fields in the table. Print one field per loop */ while (psot->pszField != NULL) { /* * Print two fields per row */ if (dwFieldsPerRow == 2) { Print("\n"); dwFieldsPerRow = 1; } else { dwFieldsPerRow++; } /* * If no address provided, Print field name(s) and offset(s) only */ if (pAddress == NULL) { Print("%03lx %-34.33s", dsoGetOffset(psot), psot->pszField); } else { /* * Printing offsets and values. * * Get the size of the value and max it to one DWORD */ dwOffsetNext = dsoGetOffset(psot + 1); if (dwOffsetNext > dwOffset) { dwSize = dwOffsetNext - dwOffset; } else { dwSize = dsoGetSize(psot, dwOffset); } if (dwSize > sizeof(DWORD)) { dwSize = sizeof(DWORD); } /* * Get a pointer to the value in the local buffer * If the value is not in the buffer, load it */ pdwValue = (PDWORD)(pBufferOffset + dwOffset); if ((pdwValue < dwBuffer) || (pdwValue + dwSize > pcdwLimit)) { pBufferOffset = (PBYTE)dwBuffer - dwOffset; pdwValue = dwBuffer; if (sizeof(dwBuffer) >= pst->dwSize - dwOffset) { dwMoveSize = pst->dwSize - dwOffset; } else { dwMoveSize = sizeof(dwBuffer); } moveBlock((PBYTE)dwBuffer, (PBYTE)pAddress + dwOffset, dwMoveSize); } /* * Copy the value and print it */ dwValue = 0; /* in case size < sizeof(DWORD) */ memcpy(&dwValue, pdwValue, dwSize); Print("(%03lx) %08lx %-24.23s", dwOffset, dwValue, psot->pszField); } /* if (pAddress == NULL) */ dwOffset = dwOffsetNext; psot++; } /* while (psot->pszField != NULL) */ Print("\n"); return TRUE; }