Coder Social home page Coder Social logo

gorapl's Introduction

goRAPL

GoDoc Go Report Card CircleCI

A dead-simple, low-level API for accessing the Intel RAPL API. Right now it's only capable of reading from MSRs, and may be expanded to write functionality at a later time.

Install

gorapl uses modules for dependency management. This means you'll need at least go 1.11. With that in mind:

$ go get github.com/fearful-symmetry/gorapl

This is a rather experimental library that's early on in it's life, so it isn't very useful yet! It has a lot of shortcomings, and a lot of things that needs to do, but can't. Most notably, it can only handle systems with one CPU socket. TODOs and progress is being tracked on the issues page.

Usage & caveats

Unless you're using something like msr-safe, gorapl requres root to access the underlying msr device at /dev/cpu/$CPU/msr.

If that device doesn't exist, you might need to load the kernel module:

$ sudo modprobe msr

Not all Intel CPUs support RAPL. The feature was introduced in Sandy Bridge, and available domains vary by processor. A quick way to check:

$ sudo rdmsr -a 0x611 #rdmsr is part of the msr-tools package on most linuxes

#You can check to see if the kernel picked up any RAPL domains too:

$ dmesg | grep rapl

Now that you're ready to go, using gorapl is easy:

    h, err := NewRAPL(0)
    if err != nil {
        // ...
    }

	dat, err := h.ReadPowerLimit(DRAM)
	if err != nil {
		//
	}
	fmt.Printf("Current RAPL power limit settings: %#v\n", dat)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.