Giter Club home page Giter Club logo

Comments (5)

acln0 avatar acln0 commented on July 19, 2024

I'm a little hazy on the event types / categories and how to query them from sysfs. Does https://godoc.org/acln.ro/perf#LookupEventType give something for "hw_interrupts"? For dynamic selection of tracepoints, we have https://godoc.org/acln.ro/perf#LookupTracepointConfig, but maybe there is a more general interface to be found here.

from perf.

pwaller avatar pwaller commented on July 19, 2024

If it's just looking in /sys/bus/event_source/devices, there is not a hw_interrupts in that directory.

from perf.

pwaller avatar pwaller commented on July 19, 2024

Found it, it's defined here:
https://github.com/torvalds/linux/blob/3bfe1fc46794631366faa3ef075e1b0ff7ba120a/tools/perf/pmu-events/arch/x86/skylake/other.json#L43

Found it by doing perf list -v pmu and then searching for the description, because it only appears as HW_INTERRUPTS and I was grepping for only the lower case. 🤦‍♂️

from perf.

pwaller avatar pwaller commented on July 19, 2024

Reading around a bit I think I want a PERF_EVENT_COUNT_RAW:

              If type is PERF_TYPE_RAW, then a custom "raw" config value is needed.  Most CPUs support events that are not covered by the "generalized" events.  These are implementation
              defined; see your CPU manual (for example the Intel Volume 3B documentation or the AMD BIOS and Kernel Developer Guide).  The libpfm4 library can be used to translate from
              the name in the architectural manuals to the raw hex value perf_event_open() expects in this field.

from perf.

pwaller avatar pwaller commented on July 19, 2024

I was able to get this event by doing the following:

	hwInt := includeKernel(&perf.Attr{
		Label:  "hw_interrupts.received",
		Type:   perf.RawEvent,
		Config: 0x1CB,
	})
func includeKernel(c perf.Configurator) perf.Configurator {
	tpattr := new(perf.Attr)
	c.Configure(tpattr)
	tpattr.Options.ExcludeKernel = false
	return tpattr
}

I figured this out with strace -f -eperf_event_open. I figure that 0x1CB is <UMask><EventCode> from other.json linked above (and also appearing in the perf -v output, in the body of this issue.

I'm going to call this issue closed. We could potentially open up a new issue to come up with a friendlier API for doing this, perhaps, but I'm unsure of the value of that at the moment.

from perf.

Related Issues (16)

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.