[pmg-devel] [PATCH v6 pmg-log-tracker/pmg-api] rewrite in rust

Mira Limbeck m.limbeck at proxmox.com
Fri Dec 20 15:08:30 CET 2019


pmg-log-tracker has been rewritten in Rust. Functionality is the same
with before queue filter support added in patch 3.

Patch 4 adds some (limited) tests. Tests can be run with 'cargo test'.

There's one change regarding the interface. In addition to the short
versions of arguments also long versions exist.

v6:
 - added before queue filter support
 - added some (limited) tests
 - add pmg-smtp-filter ID to SMTP reply on reject
v3:
 - benchmarks using /usr/bin/time instead of zsh built-in

v2:
 - patch to remove src/pmg-log-tracker.c and src/Makefile
 - added simple benchmarks

Regarding the version, how do you want to handle it? Keep the Cargo.toml
version in sync with the package version (major, minor)?

Some simple benchmarks: (32 syslog files (syslog to syslog.31.gz))

Rust: (median of 5 runs + 1 for cache)
/usr/bin/time -v sudo pmg-log-tracker -s 0 -v > /dev/null
  User time (seconds): 9.01
  System time (seconds): 0.10
  Elapsed (wall clock) time (h:mm:ss or m:ss): 0:09.12
  Maximum resident set size (kbytes): 194156

/usr/bin/time -v sudo pmg-log-tracker -s 0 -vv > /dev/null
  User time (seconds): 10.17
  System time (seconds): 0.07
  Elapsed (wall clock) time (h:mm:ss or m:ss): 0:10.24
  Maximum resident set size (kbytes): 194096

C: (same as for the rust version)
/usr/bin/time -v sudo pmg-log-tracker -s 0 -v > /dev/null
  User time (seconds): 10.41
  System time (seconds): 0.25
  Elapsed (wall clock) time (h:mm:ss or m:ss): 0:10.67
  Maximum resident set size (kbytes): 148556

/usr/bin/time -v sudo pmg-log-tracker -s 0 -vv > /dev/null
  User time (seconds): 11.67
  System time (seconds): 0.35
  Elapsed (wall clock) time (h:mm:ss or m:ss): 0:12.02
  Maximum resident set size (kbytes): 148536

Mira Limbeck (4):
  rewrite in rust
  remove C source code
  add before queue filter support
  add tests

 Cargo.toml                                   |   12 +
 Makefile                                     |    4 +-
 debian/cargo-checksum.json                   |    1 +
 debian/control                               |   17 +-
 debian/rules                                 |    2 +-
 src/Makefile                                 |   20 -
 src/main.rs                                  | 2157 +++++++++++++++
 src/pmg-log-tracker.c                        | 2580 ------------------
 tests/test_input_mixed                       |   93 +
 tests/test_output_after_queue                |  105 +
 tests/test_output_after_queue_host           |   69 +
 tests/test_output_after_queue_qid            |   27 +
 tests/test_output_after_queue_search_string  |   14 +
 tests/test_output_before_queue               |   73 +
 tests/test_output_before_queue_host          |   67 +
 tests/test_output_before_queue_qid           |   41 +
 tests/test_output_before_queue_search_string |   27 +
 tests/tests_after_queue.rs                   |  115 +
 tests/tests_before_queue.rs                  |  115 +
 tests/utils.rs                               |   31 +
 20 files changed, 2965 insertions(+), 2605 deletions(-)
 create mode 100644 Cargo.toml
 create mode 100644 debian/cargo-checksum.json
 delete mode 100644 src/Makefile
 create mode 100644 src/main.rs
 delete mode 100644 src/pmg-log-tracker.c
 create mode 100644 tests/test_input_mixed
 create mode 100644 tests/test_output_after_queue
 create mode 100644 tests/test_output_after_queue_host
 create mode 100644 tests/test_output_after_queue_qid
 create mode 100644 tests/test_output_after_queue_search_string
 create mode 100644 tests/test_output_before_queue
 create mode 100644 tests/test_output_before_queue_host
 create mode 100644 tests/test_output_before_queue_qid
 create mode 100644 tests/test_output_before_queue_search_string
 create mode 100644 tests/tests_after_queue.rs
 create mode 100644 tests/tests_before_queue.rs
 create mode 100644 tests/utils.rs

Mira Limbeck (1):
  add pmg-smtp-filter ID to reply

 src/PMG/SMTP.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
-- 
2.20.1




More information about the pmg-devel mailing list