avr: Timer0 overflow interrupt uses about one third of the CPU time
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- embedded-iot, performance
Direzione di ricerca
Start by reading the AVR Timer0 clock and PWM code, then inspect the changes described in linked issues #6070 and #6071, which this proposal depends on. Reproduce the timing measurements on an ATmega328P if hardware is available, and check how prescaler changes affect ticks() and short sleeps. Done means Timer0 uses the proposed prescaler while maintaining the intended time resolution, with the reported flash and runtime costs understood.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
On ATmega328P and ATmega1280/2560, the runtime sets Timer0 to prescaler 1 for the monotonic clock. The overflow interrupt then fires every 256 CPU cycles (16 µs at 16 MHz), and each interrupt does a 64-bit add. On an ATmega328P this takes about one third of the CPU time.
Measurements
ATmega328P (Freetronics Eleven, Uno clone) at 16 MHz, TinyGo 0.44.0. A loop wrote 32768 bytes to the SPI0 registers at 8 MHz:
| Timer0 overflow interrupt | Time |
|---|---|
| on (default) | 126 ms |
| off | 83 ms |
Both builds used -opt=2. With the default -opt=z the times were 196 ms and 126 ms.
On a SparkFun MicroView (ATmega328P), a Lorenz attractor demo on the OLED ran 13.4 frames per second with the default timer, and 20.8 frames per second with prescaler 64.
Proposal
Use prescaler 64, as the Arduino core does. The interrupt then fires every 1024 µs. To keep a fine time resolution, ticks() can add TCNT0 times the time per count, which gives 4 µs steps. Sleeps shorter than one tick can busy wait.
Cost, measured: blinky1 for arduino grows by 320 bytes of flash. RAM stays the same.
This change depends on #6071 and #6070, because the PWM code can change the Timer0 prescaler at run time.
- Lingua principale
- Go
- Stelle
- 17.8k
- Fork
- 1.1k
- Merge medio
- 1g 4h
- PR unite (30g)
- 380
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tinygo-org/tinygo
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tinygo-org/tinygo#6727 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
tinygo-org/tinygo#6711 ·
I maintainer di solito rispondono entro 1 giorno
-
Builds are not reproducible: cgo snippet paths in debug infoForse già presa @tridev-tej l’ha presa 1 giorno fa. Apertaenhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tinygo-org/tinygo#6619 ·
I maintainer di solito rispondono entro 1 giorno
-
Fix the targets that tinygo build -target rejectsForse già presa @narguis l’ha presa 2 giorni fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
tinygo-org/tinygo#6617 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
tinygo-org/tinygo#6312 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di tinygo-org/tinygo
Issue simili
-
release
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
github/gh-aw-mcpg#17603 ·
I maintainer di solito rispondono entro 1 giorno
-
help wanted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 94/100
oras-project/oras-go#1827 ·
I maintainer di solito rispondono entro 1 giorno
-
docs: database/sql Sessions example never commits its batch, and its "Full Example" link is a 404Apertadocumentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
ClickHouse/clickhouse-go#2185 ·
I maintainer di solito rispondono entro 1 giorno
-
bug needs triage receiver/podman
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
open-telemetry/opentelemetry-collector-contrib#53700 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
tagvalue.Read fails with "token too long" on lines over 64 KiBForse già presa @G26karthik l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
spdx/tools-golang#319 ·