dlogutil : add "-u" option for setting sorting buffer size 53/99553/3 accepted/tizen/3.0/ivi/20161125.080129 accepted/tizen/3.0/mobile/20161125.080011 accepted/tizen/3.0/tv/20161125.080045 accepted/tizen/3.0/wearable/20161125.080100 submit/tizen_3.0/20161124.073750
authorKichan Kwon <k_c.kwon@samsung.com>
Wed, 23 Nov 2016 08:39:25 +0000 (17:39 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 23 Nov 2016 09:31:00 +0000 (18:31 +0900)
- dlogutil -u SIZE
- If "-u" option isn't used, set to the value of conf file

Change-Id: I629c02914d87107a98cac4a83d04560a6a6a0c6f
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/logutil/logutil.c
src/logutil/logutil_doc.h

index f473ae9..eda6ac1 100644 (file)
@@ -683,7 +683,7 @@ int main(int argc, char ** argv)
                };
                int long_option_id = -1;
                optarg = NULL;
-               option = getopt_long(argc, argv, "cdt:gsf:r:n:v:b:h", long_options, &long_option_id);
+               option = getopt_long(argc, argv, "cdt:gsf:r:n:v:b:u:h", long_options, &long_option_id);
 
                if (option < 0)
                        break;
@@ -725,6 +725,13 @@ int main(int argc, char ** argv)
                                goto missing_optarg;
                        buffer_names[buffer_cnt++] = strdup(optarg);
                        break;
+               case 'u':
+                       if (!optarg)
+                               goto missing_optarg;
+                       if (!isdigit(optarg[0]))
+                               goto numeric_optarg;
+                       sort_buffer_size = atoi(optarg);
+                       break;
                case 'f':
                        if (!optarg)
                                goto missing_optarg;
@@ -791,13 +798,15 @@ int main(int argc, char ** argv)
                sort_timeout = DEFAULT_SORT_TIMEOUT;
        }
 
-       conf_value = log_config_get(&conf, "util_sorting_buffer_size");
-       if (conf_value)
-               sort_buffer_size = atoi(conf_value);
-       if (sort_buffer_size <= 0) {
-               printf("Warning: util_sorting_buffer_size should be positive! Defaulting to %d\n",
-                               DEFAULT_SORT_BUFFER_SIZE);
-               sort_buffer_size = DEFAULT_SORT_BUFFER_SIZE;
+       if (sort_buffer_size <= 1) {
+               printf("Warning: util_sorting_buffer_size should be more than 1! Get size from conf file.\n");
+               conf_value = log_config_get(&conf, "util_sorting_buffer_size");
+               if (conf_value)
+                       sort_buffer_size = atoi(conf_value);
+               if (sort_buffer_size <= 1) {
+                       printf("Warning: value of conf file is less than 2! Set to default value.\n");
+                       sort_buffer_size = DEFAULT_SORT_BUFFER_SIZE;
+               }
        }
        logs.data = (struct logger_entry**)calloc(sort_buffer_size, sizeof(struct logger_entry*));
        if (!(logs.data)) {
index dc2156e..c5ef302 100644 (file)
@@ -16,6 +16,8 @@ static void show_help(const char *cmd)
                "  -g                get the size of the log's ring buffer and exit\n"
                "  -b <buffer>       request alternate ring buffer\n"
                "                    ('main' (default), 'radio', 'system', 'apps', 'kmsg')\n"
+               "  -u <size>         Sets the size of sort buffer (size > 1)\n"
+               "                    More smaller, more faster but having less sorting quality\n"
                "  -h or --help      show this help\n"
                "  --dumpfile <file> only for pipe backend. Parses a dlog_logger daemon generated file\n"
                "filterspecs are a series of\n<tag>[:priority]\n"