elemental impure subroutine set_cpu_scaling_governor(this,scaling_governor)
class(linux_cpu), intent(inout) :: this
character(len=*), intent(in) :: scaling_governor
integer :: nunit, stat
logical :: ex
character(len=:), allocatable :: file_name
this%scaling_governor = scaling_governor
file_name = this%path_cpu//"/cpufreq/scaling_governor"
inquire(file=file_name, exist=ex)
if (ex) then
open(newunit=nunit, file=this%path_cpu//"/cpufreq/scaling_governor", iostat=stat)
write(nunit, '(a)') this%scaling_governor
close(nunit)
else
! error stop "file not found: "//file_name
endif
end subroutine set_cpu_scaling_governor