When electrons in a magnetic metal are driven far from equilibrium via ultrafast heating of the electrons, the magnetic order undergoes radical changes within tens of femtoseconds due to massive flows of energy and angular momentum between electrons, spins, and phonons. In ferrimagnetic metals such as GdFeCo, ultrafast optical heating can deterministically reverse the magnetization in less than a picosecond. In this talk, I describe our experimental work to gain a better understanding of how energy is exchanged between electrons, phonon, and spins in a magnetic metal following ultrafast heating. We use time-resolved measurements of the magneto-optic Kerr effect to record the response of ferro- and ferri-magnetic metals to heating via ultrafast optical or electrical pulses. Picosecond electrical pulses are generated with photoconductive Auston switches. By comparing the magnetic dynamics that result from electrical vs. optical heating, we identify differences in the rate of energy transfer to phonons from thermal vs. nonthermal electrons. We also find that both optical and electrical heating are effective for ultrafast switching of ferrimagnetic metals. We observe deterministic, repeatable ultrafast reversal of the magnetization of a GdFeCo thin film with a single sub-10 ps electrical pulse. The magnetization reverses in ~10 ps, which is more than one order of magnitude faster than other electrically controlled magnetic switching mechanisms.