Depending on the purpose of the watchdog timer, doing
it in code may not be the right idea. Watchdogs are often
used to ensure that a functional interrupt or infinite loop
cannot hang the program / OS execution. For such a use
you'd like something entirely independent of the processor.
Something like a retriggerable one-shot that gets reset by
code execution very specifically (i.e. quite unlikely to happen
by accident if the program / processor locks up), and throws
a non-maskable interrupt if it does ever time out.
Probably not the question you had in mind, but worth
considering.
If the watchdog resource fits this model (i.e. an independent
chunk of circuitry that the processor can only retrigger by
specific execution, and jerks the processor back if it hits)
then maybe it is useful for what I describe. But a ourely-code
"watchdog" might well sleep on the job if execution ceases
(or goes off into the weeds).