Skip to content

Add records with better units in ioc.template#85

Open
MarkRivers wants to merge 9 commits into
masterfrom
improve_units
Open

Add records with better units in ioc.template#85
MarkRivers wants to merge 9 commits into
masterfrom
improve_units

Conversation

@MarkRivers

Copy link
Copy Markdown
Member

The label in the ioc_admin_soft OPI files says the IOC_CPU_LOAD is in units % of 1 CPU, but this is not true, it is in units % of all CPUs. Create a new IOC_SINGLE_CPU_LOAD record that is in units of % of a single CPU. Change ioc_admin_soft OPI screens to use this new record, so it agrees with the label.

The memory units for FREE, USED, and MAX are in bytes. This is very hard to read on systems with lots of memory. Create new records with _GB suffix that are in units of GB.

@simon-ess simon-ess left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment, and it applies to all similar added records.

Comment thread iocAdmin/Db/ioc.template
field(INPA, "$(IOCNAME):MEM_USED")
field(CALC, "A/1e9")
field(PREC, "3")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have EGU=byte on the MEM_USED record, maybe add the equivalent here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes to EGU. imo it should be GB, and the scaling factor should be A/B where B is 1073741824 ($2^{30}$).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful. According to standards the 1024^3 units are called GiB while GB uses 1000^3.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to standards

I guess this is SI. So I have had GB and GiB backwards all these years...

@ralphlange ralphlange Jun 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the lowercase "i" was a typo.
But I will never call it "gibibyte" in public. I swear.

@ralphlange

Copy link
Copy Markdown
Member

Should we somehow deal with the fact that many sources confuse GB (1000^3) with GiB (1024^3)? Documentation-wise maybe?

@mdavidsaver

Copy link
Copy Markdown
Contributor

Create a new IOC_SINGLE_CPU_LOAD record that is in units of % of a single CPU.

Personally, I find % of total more meaningful. Also, it would be nice if HOPR for this new record were computed as well.

@MarkRivers

Copy link
Copy Markdown
Member Author

I have updated this PR:

  • Units and record names changed from GB to GiB.
  • Definition of GiB is in the .DESC field of these records.
  • Improved the color scheme in most .adl files:
    • Background for fields with ALARM status made darker to improve contrast
    • Input widgets have blue background to distinguish from outputs
    • Output widgets have dark blue text to distinguish from text widgets
  • Changed ioc_stats_soft.adl to use the waveform records for APP_DIR and ST_SCRIPT rather than the previous 2 stringin records for each.
  • Added HOPR for IOC_SINGLE_CPU_LOAD as suggested by @mdavidsaver

@ralphlange

Copy link
Copy Markdown
Member

Personally, I find % of total more meaningful.

The difference is how the numbers change when you change the (virtual) host machine's number of CPUs. % of single stays the same, so that values stay valid/comparable in the archive. % of total jumps when you change the host, making comparisons of archived data complicated.

@MarkRivers

Copy link
Copy Markdown
Member Author

Personally, I find % of total more meaningful.

For a single process I prefer units of single CPU for 2 reasons:

  • That is what "top" shows
  • The main Linux IOC machine for our beamlines has 32 cores. If I see an IOC process using 3.1% of all CPUs that does immediately raise a flag in my mind. But if I see it using 100% of a single CPU that does raise a flag, and I want to then use "top -H" to see if that load is in a single thread (bad) or spread across multiple threads (probably OK).

@MarkRivers

Copy link
Copy Markdown
Member Author

Note that I did not remove the existing IOC_CPU_LOAD record that uses units of all CPUs. I just added a new IOC_SINGLE_CPU_LOAD that uses units of a single CPU.

I also changed the ioc_stats_soft OPI screens to use the new IOC_SINGLE_CPU_LOAD rather than IOC_CPU_LOAD because the label for that value has always said "IOC (one CPU)".

@simon-ess

Copy link
Copy Markdown
Contributor

This looks good to me, although it is now failing the pre-commit check. HOWEVER this seems to be failing on auto-converted files. Did you manually update these or use a tool?

@MarkRivers

Copy link
Copy Markdown
Member Author

This looks good to me, although it is now failing the pre-commit check. HOWEVER this seems to be failing on auto-converted files. Did you manually update these or use a tool?

I use the tools that come with Phoebus, edm, caQtDM, etc.

I just ran a script locally to trim the trailing whitespace from the autoconverted files and pushed the new versions to this branch.

@MarkRivers

Copy link
Copy Markdown
Member Author

It is still failing on the end-of-file check. I ran a script locally to check and fix that all files end with a newline. It found no files that did not end with newline, so I don't understand this error.

@simon-ess

Copy link
Copy Markdown
Contributor

Hi @MarkRivers - if you run

pre-commit run --all-files

it should fine the missing EOF newlines. As in the log from the run it finds

Fixing op/edl/autoconvert/ioc_stats_epics_env.edl
Fixing op/edl/autoconvert/ioc_stats_reloadacf_confirm.edl
Fixing op/edl/autoconvert/ioc_stats_scanmon.edl
Fixing op/edl/autoconvert/ioc_stats_limits.edl
Fixing op/edl/autoconvert/ioc_stats_soft.edl
Fixing op/edl/autoconvert/ioc_stats_reboot_confirm.edl

If you like I can push these changes to your branch.

@anjohnson

Copy link
Copy Markdown
Member

@simon-ess The pre-commit command doesn't come with git nor is it installed by most Linux distro's. I did find it online, but please provide more about it (or include a link) when you recommend users run it, instead of assuming that everyone will have it installed.

@MarkRivers

Copy link
Copy Markdown
Member Author

I looked at the file ioc_stats_epics_env.edl with vi and it DOES have a newline at the end.

I ran this command to look for all files without newlines in the op/edl/autoconvert directory.

git ls-files -z | xargs -0 -L1 bash -c 'test "$(tail -c 1 "$0")" && echo "No newline: $0"'

It found no files without newlines.

I then manually removed the newline from the end of ioc_stats_epics_env.edl, and the above command still found no files without ending newlines.

I am confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants