-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Re-write sonic-db-cli with c++ for sonic startup performance issue #10491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7023120
Add sonic-cli code
liuh-80 b0943a7
Port code
liuh-80 c061404
Port code
liuh-80 5660bae
Fix build issue
liuh-80 3d47270
Add UT project
liuh-80 6a855bf
Fix build issue
liuh-80 f160a9c
Add first UT
liuh-80 696dfca
Improve code
liuh-80 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| SPATH := $($(SONIC_DB_CLI)_SRC_PATH) | ||
| DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-db-cli.mk rules/sonic-db-cli.dep | ||
| DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
| DEP_FILES += $(shell git ls-files $(SPATH)) | ||
|
|
||
| $(BASH)_CACHE_MODE := GIT_CONTENT_SHA | ||
| $(BASH)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) | ||
| $(BASH)_DEP_FILES := $(DEP_FILES) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # sonic-cli Debian package | ||
| SONIC_DB_CLI_VERSION = 1.0.0 | ||
| export SONIC_DB_CLI_VERSION | ||
|
|
||
| SONIC_DB_CLI = sonic-db-cli_$(SONIC_DB_CLI_VERSION)_$(CONFIGURED_ARCH).deb | ||
| $(SONIC_DB_CLI)_DEPENDS += $(LIBSWSSCOMMON_DEV) | ||
| $(SONIC_DB_CLI)_RDEPENDS += $(LIBSWSSCOMMON) | ||
| $(SONIC_DB_CLI)_SRC_PATH = $(SRC_PATH)/sonic-db-cli | ||
|
|
||
| SONIC_DPKG_DEBS += $(SONIC_DB_CLI) | ||
|
|
||
| # The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} | ||
| # are archived into debug one image to facilitate debugging. | ||
| # | ||
| DBG_SRC_ARCHIVE += sonic-db-cli |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ########################################################################### | ||
| ## | ||
| ## File: ./Makefile.am | ||
| ## Versions: $Id: Makefile.am,v 1.0 2022/04/02 12:04:29 liuh@microsoft.com Exp $ | ||
| ## Created: 2022/04/02 | ||
| ## | ||
| ########################################################################### | ||
| ACLOCAL_AMFLAGS = -I m4 --install | ||
| ACLOCAL_AMFLAGS = -I config | ||
| AUTOMAKE_OPTIONS = subdir-objects | ||
| SUBDIRS = tests | ||
|
|
||
| bin_PROGRAMS = sonic-db-cli | ||
| sonic_db_cli_SOURCES = sonic-db-cli.h sonic-db-cli.cpp | ||
| sonic_db_cli_CPPFLAGS = $(AM_CPPFLAGS) -std=c++17 | ||
| sonic_db_cli_LDFLAGS = -lswsscommon $(BOOST_PROGRAM_OPTIONS_LIB) | ||
|
|
||
| EXTRA_DIST = bootstrap sonic-db-cli.spec | ||
|
|
||
| MAINTAINERCLEANFILES = Makefile.in config.h.in configure aclocal.m4 \ | ||
| config/config.guess config/config.sub config/depcomp \ | ||
| config/install-sh config/ltmain.sh config/missing | ||
|
|
||
| pkgconfigdir = $(libdir)/pkgconfig | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| dnl | ||
| dnl File: configure.in | ||
| dnl Revision: $Id: configure.ac,v 1.0 2022/04/02 12:04:29 liuh@microsoft.com Exp $ | ||
| dnl Created: 2022/04/02 | ||
| dnl Author: Liu Hua <liuh@microsoft.com> | ||
| dnl | ||
| dnl Process this file with autoconf to produce a configure script | ||
| dnl You need autoconf 2.59 or better! | ||
| dnl | ||
| dnl --------------------------------------------------------------------------- | ||
|
|
||
| AC_PREREQ(2.59) | ||
| AC_COPYRIGHT([ | ||
| See the included file: COPYING for copyright information. | ||
| ]) | ||
| AC_INIT(sonic-db-cli, 1.0.0, [liuh@microsoft.com]) | ||
|
|
||
| AC_CONFIG_AUX_DIR(config) | ||
| AM_INIT_AUTOMAKE([foreign]) | ||
| AC_CONFIG_SRCDIR([sonic-db-cli.cpp]) | ||
| AC_CONFIG_HEADER([config.h]) | ||
| AC_CONFIG_MACRO_DIR([config]) | ||
| AC_CONFIG_MACRO_DIR([m4]) | ||
|
|
||
| dnl -------------------------------------------------------------------- | ||
| dnl Checks for programs. | ||
| AC_LANG_C | ||
| AC_LANG([C++]) | ||
| AC_PROG_CC | ||
| AC_PROG_CXX | ||
| AM_PROG_CC_C_O | ||
| AC_PROG_INSTALL | ||
| AC_PROG_LN_S | ||
| AC_PROG_MAKE_SET | ||
| AC_ENABLE_SHARED | ||
| AC_DISABLE_STATIC | ||
| AM_PROG_LIBTOOL | ||
|
|
||
| dnl -------------------------------------------------------------------- | ||
| dnl Checks for libraries. | ||
| AC_CHECK_LIB(swsscommon, conn) | ||
| dnl Check boost libs: https://www.gnu.org/software/autoconf-archive/The-Macros.html#The-Macros | ||
| AX_BOOST_BASE(,, [AC_MSG_ERROR([boost lib missing])]) | ||
| AX_BOOST_PROGRAM_OPTIONS | ||
|
|
||
| dnl -------------------------------------------------------------------- | ||
| dnl Checks for header files. | ||
| AC_HEADER_STDC | ||
| AC_CHECK_HEADER([swss/sonicv2connector.h], [], [AC_MSG_ERROR([swsscommon lib missing. ])] ) | ||
|
|
||
| dnl -------------------------------------------------------------------- | ||
| dnl Checks for typedefs, structures, and compiler characteristics. | ||
| AC_C_CONST | ||
| AC_TYPE_SIZE_T | ||
| AC_HEADER_TIME | ||
|
|
||
| dnl -------------------------------------------------------------------- | ||
| dnl Checks for library functions. | ||
| AC_FUNC_REALLOC | ||
| AC_FUNC_SELECT_ARGTYPES | ||
| AC_TYPE_SIGNAL | ||
| AC_CHECK_FUNCS([bzero gethostbyname gettimeofday inet_ntoa select socket logwtmp getrandom]) | ||
|
|
||
| dnl -------------------------------------------------------------------- | ||
| dnl Generate made files | ||
| AC_CONFIG_FILES([ | ||
| Makefile | ||
| tests/Makefile | ||
| ]) | ||
| AC_OUTPUT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| sonic-db-cli (1.0.0) unstable; urgency=medium | ||
|
|
||
| * Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP> | ||
|
|
||
| -- Liu Hua <liuh@microsoft.com> Wed, 06 Apr 2022 09:21:18 +0000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| Source: sonic-db-cli | ||
| Section: unknown | ||
| Priority: optional | ||
| Maintainer: Liu Hua <liuh@microsoft.com> | ||
| Build-Depends: debhelper-compat (= 13) | ||
| Standards-Version: 4.5.1 | ||
| Homepage: <insert the upstream URL, if relevant> | ||
| Rules-Requires-Root: no | ||
|
|
||
| Package: sonic-db-cli | ||
| Architecture: any | ||
| Depends: ${shlibs:Depends}, ${misc:Depends} | ||
| Description: <insert up to 60 chars description> | ||
| <insert long description, indented with spaces> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Copyright (C) 2022 Microsoft, Inc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/usr/bin/make -f | ||
| # See debhelper(7) (uncomment to enable) | ||
| # output every command that modifies files on the build system. | ||
| #export DH_VERBOSE = 1 | ||
|
|
||
|
|
||
| # see FEATURE AREAS in dpkg-buildflags(1) | ||
| #export DEB_BUILD_MAINT_OPTIONS = hardening=+all | ||
|
|
||
| # see ENVIRONMENT in dpkg-buildflags(1) | ||
| # package maintainers to append CFLAGS | ||
| #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic | ||
| # package maintainers to append LDFLAGS | ||
| #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed | ||
|
|
||
|
|
||
| %: | ||
| dh $@ | ||
|
|
||
|
|
||
| # dh_make generated override targets | ||
| # This is example for Cmake (See https://bugs.debian.org/641051 ) | ||
| #override_dh_auto_configure: | ||
| # dh_auto_configure -- \ | ||
| # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Offline discussed. Let's move this application to sonic-swss-common repo. Following original practice that in sonic-py-swsssdk repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will close this PR and send another PR for this.