Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Metrics #59

Open
osnr opened this issue Jul 25, 2023 · 6 comments
Open

New Metrics #59

osnr opened this issue Jul 25, 2023 · 6 comments
Assignees

Comments

@osnr
Copy link
Collaborator

osnr commented Jul 25, 2023

Should have:

  • stable text position (keep all lines from varying width over time, zero-pad numbers where needed)

  • current git branch, time of last commit, description of last commit, etc

  • is a laptop connected?

  • uptime?

@cwervo
Copy link
Collaborator

cwervo commented Jul 16, 2024

@osnr how do you image the "is a laptop connected?" could be queried?

@cwervo cwervo self-assigned this Jul 16, 2024
@osnr
Copy link
Collaborator Author

osnr commented Jul 16, 2024

@osnr how do you image the "is a laptop connected?" could be queried?

That's out of date -- we don't link laptops into Folk that way anymore

@cwervo
Copy link
Collaborator

cwervo commented Jul 25, 2024

@osnr Should this be a virtual program? I'm thinking of something built-in that supports

Wish $this displays metrics

So it's easy to access? Alternatively it could be a "core program" — one that we recommend people print out when they're setting up Folk the first time.

For now, I'll put this on the wiki when I test it on folk0 but this is a good checkpoint version that accomplishes I think all your suggestions above:

IMG_2042

Commit { Claim $this has metrics { \
  time 0 \
  branch ___ \
  commit {time 0 description ___} \
  uptime 0 \
  fps "00 fps" \
  step {us 00 fps 00}
}}

proc leftpad {number {width 5}} {
    return [format "%0${width}d" [expr {round($number)}]]
}

When $this has region /r/ {
  set center [region centroid $r]
  Wish $this is titled "METRICS"

  When the clock time is /t/ & $this has metrics /metricsDict/ {
      Commit { Claim $this has metrics [dict create \
         time $t \
         branch [lindex [split [exec git status] "\n"] 0] \
         commit [dict create time [exec git log -1 --format=%cd] description [exec git log -1 --format=%s]] \
         uptime [exec uptime -p] \
         fps [regsub {.*\(([0-9]+ fps)\).*} $::displayTime {\1}] \
         step [dict create \
            us [regsub {^render\s+(\d+)\s+us.*} $::displayTime {\1}] \
            fps [regsub {.*\((\d+)\s+fps\).*} $::displayTime {\1}] \
        ] \
      ]}

    Wish $this is labelled "\n
      ==== Metrics ====
      Folk clock time: [leftpad [dict get $metricsDict time] 8]
            Step time: ([leftpad [dict get $metricsDict step fps] 3] fps) | ([leftpad [dict get $metricsDict step us]] us)
          Camera time: ??? us
        AprilTag time: ??? us
               Uptime: [dict get $metricsDict uptime]

        [dict get $metricsDict branch]
 
        Most recent commit:
        -------------------
        [dict get $metricsDict commit time] [dict get $metricsDict commit description]
      " with font VictorMonoRegular
  }
}

@s-ol
Copy link
Collaborator

s-ol commented Jul 25, 2024

@cwervo If we show git info, I think it would make sense to also display the (abbreviated) commit hash, and maybe also the repo status a la git describe --tags --dirty

@cwervo
Copy link
Collaborator

cwervo commented Jul 25, 2024

@s-ol good idea re: hash, added:

https://github.com/cwervo/playground/blob/main/folk/metricsJuly2024.folk#L43


git describe --tags --dirty results in:

fatal: No names found, cannot describe anything.

because we don't use tags right now but this is a good eventual addition

@s-ol
Copy link
Collaborator

s-ol commented Jul 26, 2024

@cwervo oh right, didn't realize without tags it doesn't work at all. If there's even a single tag in the past, it gets much more useful with an output like v1.0-5-g123446-dirty which tells you:

  • last tagged version
  • number of untagged commits
  • last commit hash
  • whether there are uncommitted modifications

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

No branches or pull requests

3 participants