def find_emap(): """Search and read a perfmon event map. When the EVENTMAP environment variable is set read that, otherwise read the map for the current CPU. EVENTMAP can be a CPU specifier in the map file or a path name. Dito for the OFFCORE environment variable. Return an emap object that contains the events and can be queried or None if nothing is found or the current CPU is unknown.""" el = os.getenv("EVENTMAP") if el and el.find("/") >= 0: try: emap = EmapNativeJSON(el) oc = os.getenv("OFFCORE") if oc: emap.add_offcore(oc) return emap except IOError: return None if not el: el = event_download.get_cpustr() try: if not force_download: emap = json_with_offcore(el, True) if emap: return emap except IOError: pass try: event_download.download(el, ["core", "offcore"]) return json_with_offcore(el, False) except IOError: pass return None
def find_emap(): """Search and read a perfmon event map. When the EVENTMAP environment variable is set read that, otherwise read the map for the current CPU. Return an emap object that contains the events and can be queried or None if nothing is found or the current CPU is unknown.""" el = os.getenv("EVENTMAP") if el and el.find("/") >= 0: try: return EmapNativeJSON(el) except IOError: return None if not el: el = event_download.get_cpustr() try: emap = EmapNativeJSON(event_download.eventlist_name(el)) if emap: return emap except IOError: pass try: event_download.download(el) return EmapNativeJSON(event_download.eventlist_name(el)) except IOError: pass return None
def find_emap(): """Search and read a perfmon event map. When the EVENTMAP environment variable is set read that, otherwise read the map for the current CPU. EVENTMAP can be a CPU specifier in the map file or a path name. Dito for the OFFCORE and UNCORE environment variables. Return an emap object that contains the events and can be queried or None if nothing is found or the current CPU is unknown.""" el = os.getenv("EVENTMAP") if not el: el = event_download.get_cpustr() el = canon_emapvar(el, "core") if "/" in el: try: emap = EmapNativeJSON(el) if not emap or emap.error: return None add_extra_env(emap, el) return emap except IOError: return None try: if not force_download: emap = json_with_extra(el) if emap: add_extra_env(emap, el) return emap except IOError: pass try: toget = ["core"] if not os.getenv("OFFCORE"): toget.append("offcore") if not os.getenv("UNCORE"): toget.append("uncore") if experimental: toget += [x + " experimental" for x in toget] event_download.download(el, toget) emap = json_with_extra(el) if emap: add_extra_env(emap, el) return emap except IOError: pass return None
def find_emap(): """Search and read a perfmon event map. When the EVENTMAP environment variable is set read that, otherwise read the map for the current CPU. EVENTMAP can be a CPU specifier in the map file or a path name. Dito for the OFFCORE and UNCORE environment variables. Return an emap object that contains the events and can be queried or None if nothing is found or the current CPU is unknown.""" el = os.getenv("EVENTMAP") if not el: el = event_download.get_cpustr() if el.find("/") >= 0: try: emap = EmapNativeJSON(el) if emap: add_extra_env(emap, el) return emap except IOError: return None try: if not force_download: emap = json_with_extra(el) if emap: return emap except IOError: pass try: toget = ["core"] if not os.getenv("OFFCORE"): toget.append("offcore") if not os.getenv("UNCORE"): toget.append("uncore") if not os.getenv("UNCORE"): toget.append("uncore") event_download.download(el, toget) return json_with_extra(el) except IOError: pass return None