From 45bfa967b7e3a4887ddb17a0522e4c1c24be56d6 Mon Sep 17 00:00:00 2001 From: Kichan Kwon Date: Mon, 31 Jul 2017 11:37:40 +0900 Subject: [PATCH] [Runtime-info] Add guide about app's runtime information PS2: Reviewed Change-Id: Ia51c463e0ceca96994af76b1dc23c855c17db2d9 Signed-off-by: Kichan Kwon --- org.tizen.guides/html/native/device/runtime_n.htm | 59 +++++++++++++++++++++-- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/org.tizen.guides/html/native/device/runtime_n.htm b/org.tizen.guides/html/native/device/runtime_n.htm index 5a7d19a..4ce84ed 100644 --- a/org.tizen.guides/html/native/device/runtime_n.htm +++ b/org.tizen.guides/html/native/device/runtime_n.htm @@ -32,6 +32,7 @@
  • Prerequisites
  • Getting Runtime Information with a Key-Value Pair
  • Getting Runtime Information with a Function
  • +
  • Getting Application Runtime Information
  • Monitoring Runtime Information Changes
  • Runtime Information Keys
  • @@ -49,13 +50,15 @@

    Tizen provides various runtime information and enables your application to access it and monitor changes in it.

    The main features of the Runtime Information API include:

    +

    Prerequisites

    @@ -123,7 +126,6 @@ func(void) } -

    Getting Runtime Information with a Function

    Some runtime information can be retrieved by using a function.

    @@ -147,6 +149,54 @@ func(void) } +

    Getting Application Runtime Information

    + +

    You can get runtime information on running applications.

    +

    For example, to get the memory usage information for each application:

    + +
    +void
    +print_memory_usage(void)
    +{
    +    int ret;
    +    int i;
    +    int count;
    +    app_usage_h mem_usage_handle;
    +    char *appid;
    +    unsigned int usage;
    +
    +    ret = runtime_info_get_all_apps_memory_usage(&mem_usage_handle);
    +    if (ret != RUNTIME_INFO_ERROR_NONE) {
    +        /* Error handling */
    +    }
    +
    +    ret = runtime_info_app_usage_get_count(mem_usage_handle, &count);
    +    if (ret != RUNTIME_INFO_ERROR_NONE) {
    +        /* Error handling */
    +    }
    +
    +    for (i = 0; i < count; i++) {
    +        ret = runtime_info_app_usage_get_appid(mem_usage_handle, i, &appid);
    +        if (ret != RUNTIME_INFO_ERROR_NONE) {
    +            /* Error handling */
    +        }
    +
    +        ret = runtime_info_app_usage_get_usage(mem_usage_handle, i, &usage);
    +        if (ret != RUNTIME_INFO_ERROR_NONE) {
    +            /* Error handling */
    +        }
    +
    +        dlog_print(DLOG_INFO, LOG_TAG, "appid = %s, usage = %u KB\n", appid, usage);
    +        free(appid);
    +    }
    +
    +    ret = runtime_info_app_usage_destroy(mem_usage_handle);
    +    if (ret != RUNTIME_INFO_ERROR_NONE) {
    +        /* Error handling */
    +    }
    +}
    +
    +

    Monitoring Runtime Information Changes

    Applications can be notified about changes in the runtime information.

    @@ -303,6 +353,7 @@ func(void) + @@ -325,4 +376,4 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga - \ No newline at end of file + -- 2.7.4