If halts on every input, simulate on input while counting its steps, and output that count when it halts. The resulting function is a total computable function. Consequently yes: one may take the exact running time,
This construction does not promise a simple closed expression or a bound of any particular complexity class; it uses the promised totality of this particular machine.
For a machine computing a partial computable function, its exact halting-time function is still a partial computable function, with the same domain. A finite bound cannot cover a genuinely infinite computation. Even restricting attention to inputs on which halts, a total computable function bounding all halting times need not exist. In fact the precise characterization is the computable bound on halting time criterion:
For the forward implication, compute and simulate for that many steps. If it has not halted, the proposed bound ensures that it never will. This decides the domain. Conversely, first decide whether is in the domain; return zero outside it and the simulated halting time inside it. This defines a total computable function satisfying the bound. The time needed to compute the bound itself is irrelevant to this argument.
A universal halting recognizer has undecidable domain by the halting problem, so it has no such total bound. On the other hand, a machine that immediately halts on even inputs and loops on odd inputs computes a nontotal partial computable function but has a constant bound on its halting times. Thus nontotality alone does not decide whether a total bound exists.