ros2-performance icon indicating copy to clipboard operation
ros2-performance copied to clipboard

KeyError: 'time[ms]' in `cpu_ram_plot.py`

Open calvinyy-oss opened this issue 2 years ago • 4 comments

I use this command to generate csv files:

$ source env.sh
$ export MAX_PUBLISHERS=1
$ export MAX_SUBSCRIBERS=1
$ export MSG_TYPES="10b 100b 250b 1kb 10kb 100kb 250kb 1mb"
$ export PUBLISH_FREQUENCY="10 100 500 1000"
$ export DURATION=30
$ export NUM_EXPERIMENTS=10
$ export MON_CPU_RAM=true
$ bash scripts/pub_sub_ros2.sh
$ python scripts/plot_scripts/cpu_ram_plot.py <path_to_experiments> --x msg_type --y cpu --separator send_frequency --skip 5
Traceback (most recent call last):
  File "scripts/plot_scripts/cpu_ram_plot.py", line 209, in <module>
    main(sys.argv[1:])
  File "scripts/plot_scripts/cpu_ram_plot.py", line 182, in main
    parsed_csv = parse_csv(file_path, skip)
  File "scripts/plot_scripts/cpu_ram_plot.py", line 56, in parse_csv
    time = int(row_dict['time[ms]'])
KeyError: 'time[ms]'

calvinyy-oss avatar Apr 08 '22 17:04 calvinyy-oss

The command you used is incorrect. There are errors in the MSG_TYPES and also the msg_type argument passed to cpu_ram_plot.py is not supported.

These scripts shouldn't be used. I won't fix this problem; you are welcome to submit a pull request with the necessary fixes.

alsora avatar Apr 08 '22 17:04 alsora

Here are the output: image I know the msg_types is not right .You should set it as stamped10kb stamped 100kb etc.

calvinyy-oss avatar Apr 08 '22 17:04 calvinyy-oss

I export like this :export MSG_TYPES="stamped10b stamped100b stamped250b stamped1kb stamped10kb stamped100kb stamped250kb stamped1mb". image And I got some .csv file with data.

calvinyy-oss avatar Apr 08 '22 17:04 calvinyy-oss

As I said, the files under the script shouldn't be used as they haven't been tested/updated in years. If you want to use them you should look for the error and submit a PR. Thanks

alsora avatar Apr 08 '22 18:04 alsora