bool AVMPI_isMemoryProfilingEnabled() { #if defined (UNDER_CE) && defined(MMGC_MEMORY_PROFILER) return true; #else //read the mmgc profiling option switch const char *env = VMPI_getenv("MMGC_PROFILE"); return (env && (VMPI_strncmp(env, "1", 1) == 0)); #endif }
bool AVMPI_isMemoryProfilingEnabled() { //read the mmgc profiling option switch const char *env = getenv("MMGC_PROFILE"); return (env && (VMPI_strncmp(env, "1", 1) == 0)); }
/** * Attempt to match given the given string against our set of commands * @return the command code that was hit. */ int DebugCLI::determineCommand(DebugCLI::StringIntArray cmdList[], const char *input, int defCmd) { if (!input) return INFO_UNKNOWN_CMD; int inputLen = (int)VMPI_strlen(input); // first check for a comment if (input[0] == '#') { return CMD_COMMENT; } int match = -1; bool ambiguous = false; for (int i=0; cmdList[i].text; i++) { if (!VMPI_strncmp(input, cmdList[i].text, inputLen)) { if (match != -1) { ambiguous = true; break; } match = i; } } /** * 3 cases: * - No hits, return unknown and let our caller * dump the error. * - We match unambiguously or we have 1 or more matches * and the input is a single character. We then take the * first hit as our command. * - If we have multiple hits then we dump a 'ambiguous' message * and puke quietly. */ if (match == -1) { // no command match return unknown return defCmd; } // only 1 match or our input is 1 character or first match is exact else if (!ambiguous || inputLen == 1 || !VMPI_strcmp(cmdList[match].text, input)) { return cmdList[match].id; } else { // matches more than one command dump message and go core->console << "Ambiguous command '" << input << "': "; bool first = true; for (int i=0; cmdList[i].text; i++) { if (!VMPI_strncmp(cmdList[i].text, input, inputLen)) { if (!first) { core->console << ", "; } else { first = false; } core->console << cmdList[i].text; } } core->console << ".\n"; return -1; } }