static const wchar_t* _ALLOCATED_MEMORY = L"AllocatedMemory";
static const wchar_t* _MEMORY_ALLOCATED = L"http://tizen.org/runtime/memory.allocated";
+static const wchar_t* _MEMORY_ALLOCATED_SELF = L"http://tizen.org/runtime/memory.allocated.self";
static const wchar_t* _AVAILABLE_EXTERNAL_STORAGE = L"AvailableExternalStorage";
static const wchar_t* _STORAGE_AVAILABLE_EXTERNAL = L"http://tizen.org/runtime/storage.available.external";
{
pIntListener->OnResultReceivedForGetValueAsync(runtimeArg->intValue, runtimeArg->errorCode);
RemoveListener(listener);
- delete pIntListener;
}
}
break;
{
pLonglongListener->OnResultReceivedForGetValueAsync(runtimeArg->longLongValue, runtimeArg->errorCode);
RemoveListener(listener);
- delete pLonglongListener;
}
}
break;
SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
value = free_size * 1024;
}
- else if (key == _AVAILABLE_MEMORY || key == _AVAILABLE_VIDEO_MEMORY || key == _MAX_ALLOCATABLE_MEMORY || key == _MEMORY_AVAILABLE || key == _MEMORY_AVAILABLE_VIDEO)
+ else if (key == _AVAILABLE_MEMORY || key == _AVAILABLE_VIDEO_MEMORY || key == _MAX_ALLOCATABLE_MEMORY)
{
r = GetFromProc(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_FREE, free_size);
SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
value = free_size * 1024;
}
- else if (key == _MEMORY_ALLOCATED || key == _MEMORY_ALLOCATED_VIDEO)
- {
- r = GetFromProc(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_TOTAL, total_size);
- SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
- r = GetFromProc(_PROC_SYSTEM_MEMORY_INFO, _PROC_KEY_SYSTEM_MEMORY_FREE, free_size);
- SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
- value = (total_size - free_size) * 1024;
- }
return r;
}
-long long
-_RuntimeInfoImpl::GetDirectorySize(const char* path)
-{
- if(path == null)
- {
- return 0;
- }
-
- char command[512] = {0,};
- long long size = 0;
- int ret = 0;
-
- sprintf(command, "du -sk -P %s >> /tmp/size_of_directory.tmp", path);
-
- system("rm -rf /tmp/size_of_directory.tmp");
- system(command);
-
- FILE* pFile = null;
- pFile = fopen("/tmp/size_of_directory.tmp", "r");
- if(pFile == null)
- {
- return 0;
- }
- ret = fscanf(pFile, "%lld", &size);
-
- if(ret < 1)
- {
- if(pFile != null)
- {
- fclose(pFile);
- }
-
- return false;
- }
-
- if(pFile != null)
- {
- fclose(pFile);
- }
- system("rm -rf /tmp/size_of_directory.tmp");
- return size;
-}
-
result
_RuntimeInfoImpl::GetValue(const String& key, long long& value)
{
SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
value = (total_size - free_size) * 1024;
}
+ else if (key == _MEMORY_ALLOCATED_SELF)
+ {
+ r = GetFromProcLonglong(_PROC_PROCESS_MEMORY_INFO, _PROC_KEY_PROCESS_MEMORY, free_size);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get memory size.");
+ value = free_size * 1024;
+ }
else if (key == _AVAILABLE_INTERNAL_STORAGE)
{
return GetAvailableInternalStorage(value);
{
return GetAvailableMediaStorage(value);
}
+ else
+ {
+ SysLogException(NID_SYS, r, "Key[%ls] is not valid.", key.GetPointer());
+ }
return r;
}
+long long
+_RuntimeInfoImpl::GetDirectorySize(const char* path)
+{
+ if(path == null)
+ {
+ return 0;
+ }
+
+ char command[512] = {0,};
+ long long size = 0;
+ int ret = 0;
+
+ sprintf(command, "du -sk -P %s >> /tmp/size_of_directory.tmp", path);
+
+ system("rm -rf /tmp/size_of_directory.tmp");
+ system(command);
+
+ FILE* pFile = null;
+ pFile = fopen("/tmp/size_of_directory.tmp", "r");
+ if(pFile == null)
+ {
+ return 0;
+ }
+ ret = fscanf(pFile, "%lld", &size);
+
+ if(ret < 1)
+ {
+ if(pFile != null)
+ {
+ fclose(pFile);
+ }
+
+ return 0;
+ }
+
+ if(pFile != null)
+ {
+ fclose(pFile);
+ }
+ system("rm -rf /tmp/size_of_directory.tmp");
+ return size;
+}
+
result
_RuntimeInfoImpl::GetValue(const String& key, double& value)
{