---
name: "hwloc_get_shared_cache_covering_obj"
section: "3"
platform: "linux"
package: "hwloc"
version: "2.15.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/hwlocality_helper_find_cache"
---

# hwloc\_get\_shared\_cache\_covering\_obj(3)

Looking at Cache Objects

Part of [hwlocality\_helper\_find\_cache(3)](/hwlocality_helper_find_cache/3.md).

## NAME

hwlocality\_helper\_find\_cache - Looking at Cache Objects

## SYNOPSIS

### Functions

int **hwloc\_get\_cache\_type\_depth** (**hwloc\_topology\_t** topology, unsigned cachelevel, **hwloc\_obj\_cache\_type\_t** cachetype)\
 **hwloc\_obj\_t** **hwloc\_get\_cache\_covering\_cpuset** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** set)\
 **hwloc\_obj\_t** **hwloc\_get\_shared\_cache\_covering\_obj** (**hwloc\_topology\_t** topology, **hwloc\_obj\_t** obj)\

## Detailed Description

## Function Documentation

### hwloc\_obj\_t hwloc\_get\_cache\_covering\_cpuset (hwloc\_topology\_t topology, hwloc\_const\_cpuset\_t set) \[inline\]

Get the first data (or unified) cache covering a cpuset set.

**Returns**

a covering cache, or NULL if no cache matches.

### int hwloc\_get\_cache\_type\_depth (hwloc\_topology\_t topology, unsigned cachelevel, hwloc\_obj\_cache\_type\_t cachetype) \[inline\]

Find the depth of cache objects matching cache level and type. Return the depth of the topology level that contains cache objects whose attributes match cachelevel and cachetype.

This function is identical to calling **hwloc\_get\_type\_depth()** with the corresponding type such as **HWLOC\_OBJ\_L1ICACHE**, except that it may also return a Unified cache when looking for an instruction cache.

**Returns**

the depth of the unique matching unified cache level is returned if cachetype is **HWLOC\_OBJ\_CACHE\_UNIFIED**.

the depth of either a matching cache level or a unified cache level if cachetype is **HWLOC\_OBJ\_CACHE\_DATA** or **HWLOC\_OBJ\_CACHE\_INSTRUCTION**.

the depth of the matching level if cachetype is -1 but only one level matches.

**HWLOC\_TYPE\_DEPTH\_MULTIPLE** if cachetype is -1 but multiple levels match.

**HWLOC\_TYPE\_DEPTH\_UNKNOWN** if no cache level matches.

### hwloc\_obj\_t hwloc\_get\_shared\_cache\_covering\_obj (hwloc\_topology\_t topology, hwloc\_obj\_t obj) \[inline\]

Get the first data (or unified) cache shared between an object and somebody else.

**Returns**

a shared cache.

NULL if no cache matches or if an invalid object is given (e.g. I/O object).

## Author

Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code.
