Skip to content

Commit 7bd8789

Browse files
joyas-josephGitHub Enterprise
authored and
GitHub Enterprise
committed
Speed up clish startup (#23)
. All the ptypes were stored in a list and searched using string comparison — Use Binary tree instead (gives about 800ms improvement). . Cleanup exact duplicate ptypes . Fix use of LOG_TYPE with 2 different values. sonic# show logging filter type log: log type After: sonic# show logging filter type <syslog/inmem/all> log type
1 parent 252874e commit 7bd8789

14 files changed

+151
-95
lines changed

CLI/clitree/cli-xml/file_mgmt.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ permissions and limitations under the License. -->
286286
</PARAM>
287287
<PARAM name="copy_log_url"
288288
help="Copy from &LOG_URL;"
289-
ptype="LOG_TYPE">
289+
ptype="LOG_PREF_TYPE">
290290
<PARAM name="copy_log_options"
291291
help="Copy log options"
292292
ptype="SUBCOMMAND"

CLI/clitree/cli-xml/ipsla.xml

-12
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,6 @@ limitations under the License.
3636
pattern="1..1000"
3737
help=""
3838
/>
39-
<PTYPE
40-
name="RANGE_1_300"
41-
method="integer"
42-
pattern="1..300"
43-
help=""
44-
/>
45-
<PTYPE
46-
name="RANGE_0_65535"
47-
method="integer"
48-
pattern="0..65535"
49-
help=""
50-
/>
5139

5240
<!--=========================================================================-->
5341
<VIEW name="enable-view">

CLI/clitree/cli-xml/locator_led.xml

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ limitations under the License.
1818

1919
<CLISH_MODULE xmlns="http://www.dellemc.com/sonic/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude" xsi:schemaLocation="http://www.dellemc.com/sonic/XMLSchema http://www.dellemc.com/sonic/XMLSchema/clish.xsd">
2020
<!--=========================================================================-->
21-
<PTYPE name="TIMER_VALUE" method="integer" pattern="1..120" help="minutes"/>
22-
<!--=======================================================-->
2321

2422
<VIEW name="enable-view">
2523
<!-- locator-led -->

CLI/clitree/cli-xml/port_locator.xml

-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ limitations under the License.
1717
-->
1818

1919
<CLISH_MODULE xmlns="http://www.dellemc.com/sonic/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude" xsi:schemaLocation="http://www.dellemc.com/sonic/XMLSchema http://www.dellemc.com/sonic/XMLSchema/clish.xsd">
20-
<!--=========================================================================-->
21-
<PTYPE name="TIMER_VALUE" method="integer" pattern="1..120" help="minutes"/>
22-
<!--=======================================================-->
2320

2421
<VIEW name="enable-view">
2522
<!-- interface port-locator -->

CLI/clitree/cli-xml/snmp_types.xml

-7
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ Copyright 2020 Broadcom, Inc.
5353
help="Octet (hex) string, 5-32 octets"
5454
/>
5555
<!--=======================================================-->
56-
<PTYPE
57-
name="RANGE_1_300"
58-
method="integer"
59-
pattern="1..300"
60-
help=""
61-
/>
62-
<!--=======================================================-->
6356
<PTYPE
6457
name="LISTEN_PORT"
6558
method="integer"

CLI/clitree/cli-xml/sonic_types.xml

+21-8
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ limitations under the License.
14191419
/>
14201420
<!--========================================================-->
14211421
<PTYPE
1422-
name="LOG_TYPE"
1422+
name="LOG_PREF_TYPE"
14231423
pattern="log:\/\/[^|]+"
14241424
help="log:"
14251425
/>
@@ -1807,13 +1807,6 @@ limitations under the License.
18071807
pattern="255"
18081808
help=""
18091809
/>
1810-
<!--=======================================================-->
1811-
<PTYPE
1812-
name="RANGE_0_47"
1813-
method="integer"
1814-
pattern="0..47"
1815-
help=""
1816-
/>
18171810
<!--=======================================================-->
18181811
<PTYPE
18191812
name="RANGE_1_600"
@@ -1957,5 +1950,25 @@ limitations under the License.
19571950
help="STRING"
19581951
/>
19591952
<!--=======================================================-->
1953+
<PTYPE
1954+
name="TIMER_VALUE"
1955+
method="integer"
1956+
pattern="1..120"
1957+
help="minutes"/>
1958+
<!--=======================================================-->
1959+
<PTYPE
1960+
name="RANGE_1_300"
1961+
method="integer"
1962+
pattern="1..300"
1963+
help=""
1964+
/>
1965+
<!--=======================================================-->
1966+
<PTYPE
1967+
name="BOOL_SELECT"
1968+
method="select"
1969+
pattern="yes(yes) no(no)"
1970+
help=""
1971+
/>
1972+
<!--=======================================================-->
19601973

19611974
</CLISH_MODULE>

CLI/clitree/cli-xml/swsslog.xml

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
]>
44
<CLISH_MODULE xmlns="http://www.dellemc.com/sonic/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude" xsi:schemaLocation="http://www.dellemc.com/sonic/XMLSchema http://www.dellemc.com/sonic/XMLSchema/clish.xsd">
55

6-
<PTYPE name="BOOL_SELECT" method="select" pattern="yes(yes) no(no)" help="" />
7-
86
<VIEW name="enable-view">
97
<COMMAND help="Display components registered in DB for loglevel severity" name="show swsslog-configuration">
108
<ACTION builtin="clish_pyobj">sonic_cli_swsslog get_openconfig_loglevel_from_db tpcm.j2</ACTION>

CLI/clitree/cli-xml/tpcm.xml

-7
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@
1616
help="container_name"
1717
/>
1818

19-
<PTYPE
20-
name="BOOL_SELECT"
21-
method="select"
22-
pattern="yes(yes) no(no)"
23-
help=""
24-
/>
25-
2619

2720
<VIEW name="enable-view">
2821
<COMMAND

CLI/klish/patches/klish-2.1.4/clish/ptype.h.diff

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
9d8
22
< typedef struct clish_ptype_s clish_ptype_t;
3-
15c14
3+
11a11
4+
> #include "lub/bintree.h"
5+
15c15
46
<
57
---
68
> #include "types.h"
7-
16a16,18
9+
16a17,19
810
> #include <stdbool.h>
911
>
1012
> typedef struct clish_ptype_s clish_ptype_t;
11-
33a36,37
13+
33a37,38
1214
> CLISH_PTYPE_METHOD_REGEXP_SELECT, /* dell-emc */
1315
> CLISH_PTYPE_METHOD_TMZ_SELECT, /* dell-emc */
14-
45a50,51
16+
45a51,52
1517
> /* for checking the mode attribute */
1618
> CLISH_PTYPE_PRE_MODE,
17-
49a56,62
19+
49a57,63
1820
> enum help_type_s {
1921
> USE_NAME,
2022
> USE_VALUE,
2123
> USE_RANGE
2224
> };
2325
> typedef enum help_type_s help_type_t;
2426
>
25-
57c70,71
27+
57c71,72
2628
< clish_ptype_preprocess_e preprocess);
2729
---
2830
> clish_ptype_preprocess_e preprocess, const char *ext_pattern, const char *ext_help,
2931
> const char *alt_ext_pattern, const char *alt_pattern);
30-
68c82
32+
68c83
3133
< char *clish_ptype_validate(clish_ptype_t * instance, const char *text);
3234
---
3335
> char *clish_ptype_validate(clish_ptype_t * instance, const char *text, bool_t isHelp);
34-
84c98
36+
84c99
3537
< lub_argv_t *matches, const char *text);
3638
---
3739
> lub_argv_t *matches, const char *text, const char *penultimate_text, bool_t order);
38-
95c109,128
40+
95c110,133
3941
< const char *pattern, clish_ptype_method_e method);
4042
---
4143
> const char *pattern, clish_ptype_method_e method, const char *alt_pattern);
@@ -58,3 +60,7 @@
5860
> extern bool nos_use_alt_name(void);
5961
> char *clish_ptype_method_select__get_name(const clish_ptype_t *instance,unsigned int index);
6062
> int clish_ptype_tmz_select__get_help(clish_help_t *help, const char *pval, bool_t order);
63+
>
64+
> int clish_ptype_bt_compare(const void *clientnode, const void *clientkey);
65+
> void clish_ptype_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
66+
> size_t clish_ptype_bt_offset(void);

CLI/klish/patches/klish-2.1.4/clish/ptype/private.h.diff

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
> lub_argv_t *alt_items;
1313
> };
1414
>
15-
30a42,47
15+
27a39
16+
> lub_bintree_node_t bt_node;
17+
30a43,48
1618
>
1719
> char *ext_pattern;
1820
> char *ext_help;
1921
> char *alt_ext_pattern;
2022
> char *alt_pattern;
2123
> help_type_t usename;
22-
38a56
24+
38a57
2325
> clish_ptype_regexp_select_t regexp_select;

0 commit comments

Comments
 (0)