Commit Graph

12 Commits

Author SHA1 Message Date
David Lamparter
4bc41193e8 vtysh, lib: preprocess CLI graphs
Store a parsed and built graph of the CLI nodes in vtysh, rather than
parsing and building that graph every time vtysh starts up.

This provides a 3x to 5x reduction in vtysh startup overhead:

`vtysh -c 'configure' -c 'interface lo' -c 'do show version'`

- before: 92.9M cycles, 1114 samples
- after: 16.5M cycles, 330 samples

This improvement is particularly visible for users scripting `vtysh -c`
calls, which notably includes topotests.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-07-31 08:08:53 -04:00
David Lamparter
85b09765c4 build: warn/fail on missing XREF_SETUP()
While clippy tries really, really hard to work under adverse conditions,
and this catches missing XREF_SETUP() on almost all CPU architectures,
this doesn't quite work on hppa.  So, make it a warning on *all*
platforms (or error for --enable-dev-build) in order to catch it before
shipping off to Debian's buildd and blowing up there...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-05-02 23:03:08 +02:00
Donald Sharp
5163a1c560 lib: convert xref_threadsched to xref_eventsched
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
David Lamparter
acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
David Lamparter
6c7bc49428 python: hide inet_ntoa from frrbot
These are not the inet_ntoa you are looking for ;)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-28 11:18:06 +01:00
David Lamparter
00f0c39903 python: apply black formatting
The python/ directory hasn't been shoved into black yet (unlike
topotests, where most FRR python code is.)  Run black over it.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-28 11:01:22 +01:00
David Lamparter
89cb86aeb0 build, vtysh: extract vtysh commands from .xref
Rather than running selected source files through the preprocessor and a
bunch of perl regex'ing to get the list of all DEFUNs, use the data
collected in frr.xref.

This not only eliminates issues we've been having with preprocessor
failures due to nonexistent header files, but is also much faster.
Where extract.pl would take 5s, this now finishes in 0.2s.  And since
this is a non-parallelizable build step towards the end of the build
(dependent on a lot of other things being done already), the speedup is
actually noticeable.

Also files containing CLI no longer need to be listed in `vtysh_scan`
since the .xref data covers everything.  `#ifndef VTYSH_EXTRACT_PL`
checks are equally obsolete.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-26 17:12:34 +01:00
David Lamparter
d40aee771f python: use ujson if available
It's noticeably faster.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-06 15:40:06 +02:00
David Lamparter
9eebf97e3d lib: make cmd_element->attr a bitmask & clarify
It already "looks" like a bitmask, but we currently can't flag a command
both YANG and HIDDEN at the same time.  It really should be a bitmask.

Also clarify DEPRECATED behaviour (or the absence thereof.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-06 15:34:32 +02:00
David Lamparter
13f9aea383 build: add -Werror to xrelfo log format warnings
Adding a `\n' should now produce a warning.  Controlled by `-Werror` so
if you're doing a dev build and it's warning about some `prefix2str`
that should be converted to `%pFX`, you can turn off `-Werror` to fix it
later like with all other warnings.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-06-24 16:42:59 +02:00
David Lamparter
2621bb8b8d lib/xref: record log message format args
Apparently you can do `#__VA_ARGS__` and it actually does something
sensible, so here we go recording the format parameters for log messages
into the xref.

This allows some more checking in xrelfo.py, e.g. hints to use `%pFX`
and co.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-23 16:56:58 +01:00
David Lamparter
36a8fdfd74 python/xrelfo: the ELF xref extractor
This creates JSON dumps of all the xref structs littered around FRR.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-23 16:56:58 +01:00