void QueryCostInfo :: translateToExternalFormat(SQL_QUERY_COST_INFO *query_cost_info) { query_cost_info->cpuTime = cpuTime(); query_cost_info->ioTime = ioTime(); query_cost_info->msgTime = msgTime(); query_cost_info->idleTime = idleTime(); query_cost_info->totalTime = totalTime(); query_cost_info->cardinality = cardinality(); query_cost_info->estimatedTotalMem = totalMem(); query_cost_info->resourceUsage = resourceUsage(); query_cost_info->maxCpuUsage = maxCpuUsage(); }
TInt CMemoryMonitor::GetFreeMemory() { FUNC_LOG; if (!eglQueryProfilingData) { TRACES("EGL_NOK_resource_profiling not available"); return 0; } EGLint data_count; EGLint* prof_data; TInt i(0); TInt totalMem(0); TInt totalUsed(0); EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); /* Find out how much profiling data is available */ eglQueryProfilingData(dpy, EGL_PROF_QUERY_GLOBAL_BIT_NOK | EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK, NULL, 0, &data_count); TRACES1("eglQueryProfilingData - data size: %d", data_count); /* Allocate room for the profiling data */ prof_data = (EGLint*)User::Alloc(data_count * sizeof(EGLint)); TRACES("eglQueryProfilingData - alloc for data done"); if (prof_data == NULL) { TRACES1("eglQueryProfilingData - could not alloc: %d", data_count * sizeof(EGLint)); return KErrNoMemory; } /* Retrieve the profiling data */ eglQueryProfilingData(dpy, EGL_PROF_QUERY_GLOBAL_BIT_NOK | EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK, prof_data, data_count, &data_count); TRACES("eglQueryProfilingData - profiling data acquired"); /* Iterate over the returned data */ while (i < data_count) { TRACES2("EGL_NOK_resource_profiling - index: %d data: %d", i, prof_data[i]); switch (prof_data[i++]) { case EGL_PROF_USED_MEMORY_NOK: { totalUsed = prof_data[i++]; TRACES1("EGL_NOK_resource_profiling - total Used: %d", totalUsed); break; } case EGL_PROF_TOTAL_MEMORY_NOK: { totalMem = prof_data[i++]; TRACES1("EGL_NOK_resource_profiling - total Mem: %d", totalMem); break; } case EGL_PROF_PROCESS_ID_NOK: { if (sizeof(EGLNativeProcessIdTypeNOK) == 8) { i+=2; } else { i++; } break; } case EGL_PROF_PROCESS_USED_PRIVATE_MEMORY_NOK: { TUint mem = prof_data[i]; TRACES1("Private memory Usage by app is %d", mem); break; } case EGL_PROF_PROCESS_USED_SHARED_MEMORY_NOK: { TUint mem = prof_data[i]; TRACES1("Shared memory Usage by app is %d", mem); break; } default: { i++; break; } } } /* Free allocated memory */ User::Free(prof_data); if ((totalMem-totalUsed) < 0) { return 0; } return totalMem - totalUsed; }