<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Michael,<br>
    <br>
    looks good to me.<br>
    <br>
    IMO API calls representing direct shell commands should not be
    represented as getters/setters in the JS API, so ".Pause()" &
    ".Resume()" are better. They are also more readable (e.g. "Resume()"
    vs "SetUserPaused(false)") and leave room for future command
    specific arguments.<br>
    <br>
    Using an object structure is OK for the times, unless you want/need
    to make sure the same order as with the other outputs (shell/data)
    will be kept stable on any object transformation or transfer. Object
    properties (if they are strings) are normally kept in insertion
    order, but only within Javascript. When deserializing JS objects
    into other environments, the order isn't guaranteed.<br>
    <br>
    Regards,<br>
    Michael<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 06.07.24 um 03:12 schrieb Michael
      Geddes via OvmsDev:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAH0p7u+ZHLubQyS8Qh=6AxuZedGZS=AgqKxVna6aS7JT9qKNHw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>please have a good look at the function names.. when I have
          Get and Set prefixes.. should I have them.. etc to be
          consistent.</div>
        <div><br>
        </div>
        <div>But  Just FYI (a couple of silly bugs later) - This is the
          full output from a test proving that both the 'Times' property
          works and that at least as a concept- having the "Poll:PRI" as
          a key works.</div>
        <div>//.</div>
        <div>----8<-------------------</div>
        <div dir="ltr"><br>
          <div><font style="background-color:rgb(207,226,243)"
              face="monospace">JSON.print(OvmsPoller.Times.GetStatus())</font><br>
            <font style="background-color:rgb(238,238,238)"
              face="monospace"><br>
              {<br>
                "items": {<br>
                  "Poll:PRI": {<br>
                    "count_hz": 1.00600004196167,<br>
                    "avg_util_pm": 0.5598000288009644,<br>
                    "peak_util_pm": 0.6503999829292297,<br>
                    "avg_time_ms": 0.05350000038743019,<br>
                    "peak_time_ms": 0.9779999852180481<br>
                  },<br>
                  "Poll:SRX": {<br>
                    "count_hz": 1.1330000162124634,<br>
                    "avg_util_pm": 0.18970000743865967,<br>
                    "peak_util_pm": 0.23240000009536743,<br>
                    "avg_time_ms": 0.015799999237060547,<br>
                    "peak_time_ms": 0.3319999873638153<br>
                  },<br>
                  "RxCan1[778]": {<br>
                    "count_hz": 1.8489999771118164,<br>
                    "avg_util_pm": 1.2870999574661255,<br>
                    "peak_util_pm": 1.8909000158309937,<br>
                    "avg_time_ms": 0.06909999996423721,<br>
                    "peak_time_ms": 2.7119998931884766<br>
                  },<br>
                  "RxCan1[7bb]": {<br>
                    "count_hz": 0.2240000069141388,<br>
                    "avg_util_pm": 0.10409999638795853,<br>
                    "peak_util_pm": 0.25859999656677246,<br>
                    "avg_time_ms": 0.043800000101327896,<br>
                    "peak_time_ms": 1.50600004196167<br>
                  },<br>
                  "RxCan1[7ea]": {<br>
                    "count_hz": 1.0670000314712524,<br>
                    "avg_util_pm": 0.4699000120162964,<br>
                    "peak_util_pm": 0.7283999919891357,<br>
                    "avg_time_ms": 0.04830000177025795,<br>
                    "peak_time_ms": 1.5379999876022339<br>
                  },<br>
                  "RxCan1[7ec]": {<br>
                    "count_hz": 1.8669999837875366,<br>
                    "avg_util_pm": 0.8090000152587891,<br>
                    "peak_util_pm": 0.9458000063896179,<br>
                    "avg_time_ms": 0.04639999940991402,<br>
                    "peak_time_ms": 2.2769999504089355<br>
                  },<br>
                  "TxCan1[770]": {<br>
                    "count_hz": 0.9240000247955322,<br>
                    "avg_util_pm": 0.039400000125169754,<br>
                    "peak_util_pm": 0.054499998688697815,<br>
                    "avg_time_ms": 0.0038999998942017555,<br>
                    "peak_time_ms": 0.08699999749660492<br>
                  },<br>
                  "TxCan1[7b3]": {<br>
                    "count_hz": 0.041999999433755875,<br>
                    "avg_util_pm": 0.0035000001080334187,<br>
                    "peak_util_pm": 0.008299999870359898,<br>
                    "avg_time_ms": 0.008500000461935997,<br>
                    "peak_time_ms": 0.09200000017881393<br>
                  },<br>
                  "TxCan1[7e2]": {<br>
                    "count_hz": 0.21199999749660492,<br>
                    "avg_util_pm": 0.01600000075995922,<br>
                    "peak_util_pm": 0.020500000566244125,<br>
                    "avg_time_ms": 0.006800000090152025,<br>
                    "peak_time_ms": 0.08500000089406967<br>
                  },<br>
                  "TxCan1[7e4]": {<br>
                    "count_hz": 0.21199999749660492,<br>
                    "avg_util_pm": 0.006899999920278788,<br>
                    "peak_util_pm": 0.009800000116229057,<br>
                    "avg_time_ms": 0.002899999963119626,<br>
                    "peak_time_ms": 0.05299999937415123<br>
                  },<br>
                  "Cmd:Thrtl": {<br>
                    "count_hz": 0.014999999664723873,<br>
                    "avg_util_pm": 0.0006000000284984708,<br>
                    "peak_util_pm": 0,<br>
                    "avg_time_ms": 0.004699999932199717,<br>
                    "peak_time_ms": 0.04699999839067459<br>
                  },<br>
                  "Cmd:State": {<br>
                    "count_hz": 0.039000000804662704,<br>
                    "avg_util_pm": 0.002300000051036477,<br>
                    "peak_util_pm": 0.007000000216066837,<br>
                    "avg_time_ms": 0.006500000134110451,<br>
                    "peak_time_ms": 0.09000000357627869<br>
                  }<br>
                },<br>
                "tot_count_hz": 8.59000015258789,<br>
                "tot_util_pm": 3.488300085067749,<br>
                "tot_time_ms": 3.1019999980926514<br>
              }</font></div>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Wed, 3 Jul 2024 at 14:31,
            Michael Geddes <<a
              href="mailto:frog@bunyip.wheelycreek.net"
              moz-do-not-send="true" class="moz-txt-link-freetext">frog@bunyip.wheelycreek.net</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div dir="ltr">OH, and also,
              <div><br>
              </div>
              <div>What do you think of treating the O<span
                  style="font-family:monospace">vmsPoller.Times.GetStatus()
                </span><font face="arial, sans-serif">items as an
                  associative array - or should I treat it as a normal
                  array?</font></div>
              <div><font face="arial, sans-serif"><br>
                </font></div>
              <div><font face="arial, sans-serif">//.ichael</font></div>
            </div>
            <br>
            <div class="gmail_quote">
              <div dir="ltr" class="gmail_attr">On Wed, 3 Jul 2024 at
                14:24, Michael Geddes <<a
                  href="mailto:frog@bunyip.wheelycreek.net"
                  target="_blank" moz-do-not-send="true"
                  class="moz-txt-link-freetext">frog@bunyip.wheelycreek.net</a>>
                wrote:<br>
              </div>
              <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                <div dir="ltr">I figured I may as well add an OvmsPoller
                  object to DukTape for Ovms.   I'm waiting to get back
                  to my OVMS so that I can test it.. but this is the
                  documentation I have for the stuff I have coded.
                  Thoughts on this?
                  <div><br>
                  </div>
                  <div>What do people think of OvmsPoller.Times
                    sub-object?   I've added a general mechanism for
                    this.  </div>
                  <div><br>
                  </div>
                  <div>Also should I have OvmsPoller.Pause()  or
                    OvmsPoller.SetUserPaused(true)  ?</div>
                  <div>//.</div>
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                  <div><font face="monospace">OvmsPoller<br>
                      ^^^^^^^^^^<br>
                      The Ovms Poller object represents the poller
                      sub-system. It contains the following methods:<br>
                      <br>
                      - ``ispaused = OvmsPoller.GetPaused()``: Return
                      true if the poller is paused by the system/user.<br>
                      - ``ispaused = OvmsPoller.GetUserPaused()``:
                      Return true if the poller is paused by the user.<br>
                      - ``OvmsPoller.Pause()``: Pause the poller (adds
                      User poller pause)<br>
                      - ``OvmsPoller.Resume()``: Remove the User poller
                      pause.<br>
                      <br>
                      - ``tracemode = OvmsPoller.GetTrace()``: Return
                      the current trace mode.<br>
                      - ``OvmsPoller.SetTrace(tracemode)``: Set the
                      current trace mode.<br>
                      <br>
                          The Traces still require that 'Verbose' and
                      'Debug' levels (depending) for the 'vehicle-poll'<br>
                          debug tag are set.<br>
                          Trace modes for verbose logging can be one of:<br>
                          - ``on``: On for poller loop<br>
                          - ``txrx``: On for txrx queue (this can be
                      hazardous for some cars)<br>
                          - ``all``: On for both poller loop and txrx
                      queuing<br>
                          - ``off``: Logging Off<br>
                          Note that only ``on`` and ``off`` are
                      recommended.<br>
                      <br>
                      The poller object also contains a ``Times``
                      property for the OBD Poll-Time tracing<br>
                      which contains the following methods:<br>
                      - ``isrunning = OvmsPoller.Times.GetEnabled()``:
                      Returns true if the time-tracing is enabled<br>
                      - ``OvmsPoller.Times.SetEnabled(isrunning)``: Sets
                      the enabled status of the timer-tracing<br>
                      - ``OvmsPoller.Times.Reset()``: Reset the timers
                      (doesn't affect their current state).<br>
                      - ``OvmsPoller.Times.GetStatus()``: Gets the
                      status of the various times. This returns an
                      object<br>
                          of this format:<br>
                          .. code-block:: javascript<br>
                          return_value = {<br>
                            "items": {<br>
                              "Poll:PRI" : {<br>
                                "count_hz":    1,<br>
                                "avg_util_pm": 0.529,<br>
                                "peak_util_pm":0.652,<br>
                                "avg_time_ms": 0.052,<br>
                                "peak_time_ms":1.516<br>
                              },<br>
                              "Poll:SRX": {<br>
                                "count_hz":    1.47,<br>
                                "avg_util_pm": 0.302,<br>
                                "peak_util_pm":0.44,<br>
                                "avg_time_ms": 0.02,<br>
                                "peak_time_ms":0.573<br>
                              },<br>
                              "RxCan1[778]": {<br>
                                "count_hz":    0.74,<br>
                                "avg_util_pm": 0.427,<br>
                                "peak_util_pm":0.826,<br>
                                "avg_time_ms": 0.063,<br>
                                "peak_time_ms":1.872<br>
                              },<br>
                              "RxCan1[7a8]": {<br>
                                "count_hz":    0.35,<br>
                                "avg_util_pm": 0.183,<br>
                                "peak_util_pm":0.355,<br>
                                "avg_time_ms": 0.052,<br>
                                "peak_time_ms":1.382<br>
                              },<br>
                              "TxCan1[7b3]": {<br>
                                "count_hz":    0.07,<br>
                                "avg_util_pm": 0.005,<br>
                                "peak_util_pm":0.01,<br>
                                "avg_time_ms": 0.007,<br>
                                "peak_time_ms":0.099<br>
                              },<br>
                              "TxCan1[7c6]": {<br>
                                "count_hz":    0,<br>
                                "avg_util_pm": 0,<br>
                                "peak_util_pm":0.009,<br>
                                "avg_time_ms": 0.004,<br>
                                "peak_time_ms":0.098<br>
                              },<br>
                              "Cmd:State": {<br>
                                "count_hz":    0,<br>
                                "avg_util_pm": 0,<br>
                                "peak_util_pm":0,<br>
                                "avg_time_ms": 0.011,<br>
                                "peak_time_ms":0.109<br>
                              }<br>
                            },<br>
                      <br>
                            "tot_count_hz": 11.76,<br>
                            "tot_util_pm": 6.247,<br>
                            "tot_time_ms": 4.628<br>
                          };</font><br>
                  </div>
                </div>
              </blockquote>
            </div>
          </blockquote>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26</pre>
  </body>
</html>