set_cpu_scaling_max_freq Subroutine

private impure elemental subroutine set_cpu_scaling_max_freq(this, max_freq)

Type Bound

linux_cpu

Arguments

Type IntentOptional Attributes Name
class(linux_cpu), intent(inout) :: this
integer, intent(in) :: max_freq

Contents


Source Code

   elemental impure subroutine set_cpu_scaling_max_freq(this,max_freq)
      class(linux_cpu), intent(inout) :: this
      integer, intent(in)             :: max_freq
      integer                         :: nunit, stat
      logical                         :: ex
      character(len=:), allocatable   :: file_name

      this%scaling_max_freq = max_freq

      file_name = this%path_cpu//"/cpufreq/scaling_max_freq"
      inquire(file=file_name, exist=ex)
      if (ex) then
         open(newunit=nunit, file=file_name, iostat=stat)
         write(nunit, '(i0)') this%scaling_max_freq
         close(nunit)
      else
         ! error stop "file not found: "//file_name
      endif
   end subroutine set_cpu_scaling_max_freq