Restore original frequency on exit.

PR:		bin/113813
This commit is contained in:
Alexander Motin 2008-11-18 15:48:23 +00:00
parent 21543d8055
commit 8cb16fdbea
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=185053

View File

@ -422,7 +422,7 @@ main(int argc, char * argv[])
int nfds;
struct pidfh *pfh = NULL;
const char *pidfile = NULL;
int freq, curfreq, *freqs, i, j, *mwatts, numfreqs, load;
int freq, curfreq, initfreq, *freqs, i, j, *mwatts, numfreqs, load;
int ch, mode, mode_ac, mode_battery, mode_none;
uint64_t mjoules_used;
size_t len;
@ -536,7 +536,7 @@ main(int argc, char * argv[])
signal(SIGINT, handle_sigs);
signal(SIGTERM, handle_sigs);
freq = get_freq();
freq = initfreq = get_freq();
if (freq < 1)
freq = 1;
/* Main loop. */
@ -682,6 +682,8 @@ main(int argc, char * argv[])
freqs[j]);
}
}
if (set_freq(initfreq))
warn("error setting CPU frequency %d", initfreq);
free(freqs);
free(mwatts);
devd_close();