public static extern int GetSystemMemoryInfo(out MemoryInfo memoryInfo);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_process_memory_info")]
- public static extern int GetProcessMemoryInfo(int[] pid, int size, out ProcessMemoryInfo[] array);
+ public static extern int GetProcessMemoryInfo(int[] pid, int size, ref IntPtr array);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_cpu_usage")]
public static extern int GetCpuUsage(out CpuUsage cpuUsage);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_process_cpu_usage")]
- public static extern int GetProcessCpuUsage(int[] pid, int size, out ProcessCpuUsage[] array);
+ public static extern int GetProcessCpuUsage(int[] pid, int size, ref IntPtr array);
[DllImport(Libraries.RuntimeInfo, EntryPoint = "runtime_info_get_processor_count")]
public static extern int GetProcessorCount(out int processorCount);
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
+using System.Runtime.InteropServices;
namespace Tizen.System
{
int[] processArray = pid.ToArray<int>();
Interop.RuntimeInfo.ProcessMemoryInfo[] processMemoryArray = new Interop.RuntimeInfo.ProcessMemoryInfo[pid.Count<int>()];
Dictionary<int, ProcessMemoryInformation> map = new Dictionary<int, ProcessMemoryInformation>();
- int ret = Interop.RuntimeInfo.GetProcessMemoryInfo(processArray, pid.Count<int>(), out processMemoryArray);
+ IntPtr ptr = new IntPtr();
+ int ret = Interop.RuntimeInfo.GetProcessMemoryInfo(processArray, pid.Count<int>(), ref ptr);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Process memory information");
RuntimeInfoErrorFactory.ThrowException(ret);
}
+ for (int i = 0; i < pid.Count<int>(); i++)
+ {
+ processMemoryArray[i] = Marshal.PtrToStructure<Interop.RuntimeInfo.ProcessMemoryInfo>(ptr);
+ ptr += Marshal.SizeOf<Interop.RuntimeInfo.ProcessCpuUsage>();
+ }
+
int idx = 0;
foreach (Interop.RuntimeInfo.ProcessMemoryInfo cur in processMemoryArray)
{
int[] processArray = pid.ToArray<int>();
Interop.RuntimeInfo.ProcessCpuUsage[] processCpuUsageArray = new Interop.RuntimeInfo.ProcessCpuUsage[pid.Count<int>()];
Dictionary<int, ProcessCpuUsage> map = new Dictionary<int, ProcessCpuUsage>();
- int ret = Interop.RuntimeInfo.GetProcessCpuUsage(processArray, pid.Count<int>(), out processCpuUsageArray);
+ IntPtr ptr = new IntPtr();
+ int ret = Interop.RuntimeInfo.GetProcessCpuUsage(processArray, pid.Count<int>(), ref ptr);
if (ret != (int)RuntimeInfoError.None)
{
Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Process cpu usage");
RuntimeInfoErrorFactory.ThrowException(ret);
}
+ for (int i = 0; i < pid.Count<int>(); i++)
+ {
+ processCpuUsageArray[i] = Marshal.PtrToStructure<Interop.RuntimeInfo.ProcessCpuUsage>(ptr);
+ ptr += Marshal.SizeOf<Interop.RuntimeInfo.ProcessCpuUsage>();
+ }
+
int idx = 0;
foreach (Interop.RuntimeInfo.ProcessCpuUsage cur in processCpuUsageArray)
{
/// <since_tizen> 3 </since_tizen>
/// <param name="coreId">The index (from 0) of the CPU core that you want to know the frequency of.</param>
/// <returns>The current frequency(MHz) of processor.</returns>
- /// <exception cref="ArgumentException">Thrown when the <paramref name="coreid"/> is invalid.</exception>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="coreId"/> is invalid.</exception>
/// <exception cref="IOException">Thrown when an I/O error occurs while reading from system.</exception>
/// <exception cref="NotSupportedException">Thrown when this system does not store the current CPU frequency.</exception>
public static int GetProcessorCurrentFrequency(int coreId)
/// <since_tizen> 3 </since_tizen>
/// <param name="coreId">The index (from 0) of CPU core that you want to know the frequency of.</param>
/// <returns>The max frequency(MHz) of processor.</returns>
- /// <exception cref="ArgumentException">Thrown when the <paramref name="coreid"/> is invalid.</exception>
+ /// <exception cref="ArgumentException">Thrown when the <paramref name="coreId"/> is invalid.</exception>
/// <exception cref="IOException">Thrown when an I/O error occurs while reading from system.</exception>
/// <exception cref="NotSupportedException">Thrown when this system does not store the max CPU frequency.</exception>
public static int GetProcessorMaxFrequency(int coreId)