cms-gem-daq-project / reg_utils

0 stars 9 forks source link

Change default behavior of writeReg to not print to terminal on every call #47

Closed bdorney closed 5 years ago

bdorney commented 5 years ago

Brief summary of issue

The writeReg function in the python API makes what I feel are undesired print statements to terminal. I would suggest that this is changed to only make print statements when a debugging flag was provided.

Types of issue

Expected Behavior

The code would only print the write attempt to terminal if a debug flag existed and debug=True was passed at runtime.

e.g.

Changing the function declaration from:

https://github.com/cms-gem-daq-project/reg_utils/blob/2879f89d67994212d0d71f0616224195edc79ea9/python/reg_interface/common/reg_base_ops.py#L99

to:

def writeReg(reg, value, debug=False):

And changing line 104:

https://github.com/cms-gem-daq-project/reg_utils/blob/2879f89d67994212d0d71f0616224195edc79ea9/python/reg_interface/common/reg_base_ops.py#L103-L104

to:

    if debug:
        print "Initial value to write: %s, register %s"% (value,reg.name)

Current Behavior

Shown in lines 99-128:

https://github.com/cms-gem-daq-project/reg_utils/blob/2879f89d67994212d0d71f0616224195edc79ea9/python/reg_interface/common/reg_base_ops.py#L99-L128

Presently the code will always print the write attempt to terminal.

Context (for feature requests)

Clutters terminal output when write transactions are performed, e.g.:

Initial value to write: 2010212, register GEM_AMC.DAQ.EXT_CONTROL.RUN_PARAMS
CurrentStep:: 0xa82 0x4b0 0x4b0  2  8  0xf5   0xf5   0xf5   0xf5   0xf5   0xf5   0xf5   0xf5   0x00   0xf5   0xf5   0xf5   0xf5   0x00   0xf5   0xf5   0x00   0x00   0xf5   0xf5   0x00   0x00   0xf5   0x00
Initial value to write: 2026596, register GEM_AMC.DAQ.EXT_CONTROL.RUN_PARAMS
CurrentStep:: 0xa96 0x4c4 0x4c4  2  8  0xf7   0xf7   0xf7   0xf7   0xf7   0xf7   0xf7   0xf7   0x00   0xf7   0xf7   0xf7   0xf7   0x00   0xf7   0xf7   0x00   0x00   0xf7   0xf7   0x00   0x00   0xf7   0x00
Initial value to write: 2042980, register GEM_AMC.DAQ.EXT_CONTROL.RUN_PARAMS
CurrentStep:: 0xaaa 0x4d8 0x4d8  2  8  0xf9   0xf9   0xf9   0xf9   0xf9   0xf9   0xf9   0xf9   0x00   0xf9   0xf9   0xf9   0xf9   0x00   0xf9   0xf9   0x00   0x00   0xf9   0xf9   0x00   0x00   0xf9   0x00
Initial value to write: 2059364, register GEM_AMC.DAQ.EXT_CONTROL.RUN_PARAMS
CurrentStep:: 0xabe 0x4ec 0x4ec  2  8  0xfb   0xfb   0xfb   0xfb   0xfb   0xfb   0xfb   0xfb   0x00   0xfb   0xfb   0xfb   0xfb   0x00   0xfb   0xfb   0x00   0x00   0xfb   0xfb   0x00   0x00   0xfb   0x00
Initial value to write: 2075748, register GEM_AMC.DAQ.EXT_CONTROL.RUN_PARAMS
CurrentStep:: 0xad2 0x500 0x500  2  8  0xfd   0xfd   0xfd   0xfd   0xfd   0xfd   0xfd   0xfd   0x00   0xfd   0xfd   0xfd   0xfd   0x00   0xfd   0xfd   0x00   0x00   0xfd   0xfd   0x00   0x00   0xfd   0x00

Your Environment

bdorney commented 5 years ago

After discussion in SW dev meeting we decided to just remove that print statement.