Skip to content

CONFIG_PROC_(LOG)_HAVE_CHRONO misleading #2

Open

Description

@beartronix

https://github.com/NoOrientationProgramming/SystemCore/blob/5d4128c686e7b42be67950a2216f33d41561af53/Log.cpp#L33

was previously CONFIG_PROC_HAVE_CHRONO and in Processing.h (better in my opinion because other Processes also (can) reference this define

Activity

  1. beartronix commented on Aug 3, 2025

    @beartronix
    Author

    related: nowMs() and millis() are ambiguous:
    https://github.com/NoOrientationProgramming/SystemCore/blob/5d4128c686e7b42be67950a2216f33d41561af53/Pipe.h#L60
    https://github.com/NoOrientationProgramming/SystemCore/blob/5d4128c686e7b42be67950a2216f33d41561af53/TcpTransfering.cpp#L754
    question again: why implement millis() everywhere instead of a central location? (or better: don't implement and leave it to the application code)

  2. self-assigned this
    on Aug 5, 2025
  3. Naegolus commented on Aug 12, 2025

    @Naegolus
    Contributor

    Thanks for the input! I will try to work on this asap.

    Response to your question (no answer but more brainstorming)

    I do not follow the DRY principle to 100%. It's more like 90%. A central location means that multiple units like A, B and C would be related to another unit called D for example. The strength of the coupling decides if code duplication is OK for me. If the coupling is low, then code duplication is allowed, otherwise it's a clear dependency of multiple units to one topic.
    In general I would like to avoid a "Core Library". On the other hand there is one central unit of course: Processing.cpp

    Another question is: Should the base Processing() provide minimal time-related functions?

    One argument for yes could be: A process is a function that needs time for creating its output. For me a function has the signature y = f(x) whereas the signature of a process would be y = p(x, t). In this sense, time is tightly coupled to the concept of a process.
    But time is considered by the function success() already. At the moment a process has an abstract state for mapping time: Not finished (Pending) and finished (Positive or not).

    Important structure info

    We have multiple system layers

    1. SystemCore
      1.1 Processing.cpp
      1.2 Other cpp files
    2. Concrete process libraries
    3. Application / project specific processes

    The core is divided into two layers. The file Processing.cpp must be compile-able for all systems. Simple and complex, with standard libraries and without. I have to think about it, how time should be integrated in the sources. At compile time or runtime.

    Current situtation

    TcpTransfering::millis() is intentionally a private function, which should not be used by external user code. But for some targets this is a problem which must be resolved, because the code still must be compiled.

    Same strategy with CONFIG_PROC_LOG_HAVE_CHRONO. This is a private define localized in Log.cpp. User code should not reference it.

    Pipe.h is one possible way for Inter-Process-Communication. This file has a public connection to time. At the moment I am wondering if this is a good place for a function / define called nowMs() :|

    Result

    This issue is important but will take some time.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions