Skip to content

Instantly share code, notes, and snippets.

@michaelwu
Created July 8, 2015 07:30
Show Gist options
  • Save michaelwu/9f10f60dc8b2c8e881cd to your computer and use it in GitHub Desktop.
Save michaelwu/9f10f60dc8b2c8e881cd to your computer and use it in GitHub Desktop.
memorymetrics.rs
/* automatically generated by rust-bindgen */
pub enum nsISupports { }
#[repr(C)]
#[derive(Copy)]
pub struct TabSizes {
pub objects: size_t,
pub strings: size_t,
pub private_: size_t,
pub other: size_t,
}
impl ::std::default::Default for TabSizes {
fn default() -> TabSizes { unsafe { ::std::mem::zeroed() } }
}
#[repr(i32)]
#[derive(Copy)]
pub enum TabSizes_Kind { Objects = 0, Strings = 1, Private = 2, Other = 3, }
extern "C" {
fn _ZN2JS8TabSizes3addENS0_4KindEj(this: *mut TabSizes, kind: Kind,
n: size_t);
}
impl TabSizes {
#[inline]
pub unsafe extern "C" fn add(&mut self, kind: Kind, n: size_t) {
_ZN2JS8TabSizes3addENS0_4KindEj(&mut *self, kind, n)
}
}
#[repr(C)]
#[derive(Copy)]
pub struct InefficientNonFlatteningStringHashPolicy;
impl ::std::default::Default for InefficientNonFlatteningStringHashPolicy {
fn default() -> InefficientNonFlatteningStringHashPolicy {
unsafe { ::std::mem::zeroed() }
}
}
extern "C" {
fn _ZN2js40InefficientNonFlatteningStringHashPolicy4hashERKP8JSString(l:
&Lookup)
-> HashNumber;
fn _ZN2js40InefficientNonFlatteningStringHashPolicy5matchERKPK8JSStringRKPS1_(k:
&*const JSString,
l:
&Lookup)
-> bool;
}
impl InefficientNonFlatteningStringHashPolicy {
#[inline]
pub unsafe extern "C" fn hash(l: &Lookup) -> HashNumber {
_ZN2js40InefficientNonFlatteningStringHashPolicy4hashERKP8JSString(l)
}
#[inline]
pub unsafe extern "C" fn match(k: &*const JSString, l: &Lookup) -> bool {
_ZN2js40InefficientNonFlatteningStringHashPolicy5matchERKPK8JSStringRKPS1_(k,
l)
}
}
#[repr(C)]
#[derive(Copy)]
pub struct CStringHashPolicy;
impl ::std::default::Default for CStringHashPolicy {
fn default() -> CStringHashPolicy { unsafe { ::std::mem::zeroed() } }
}
extern "C" {
fn _ZN2js17CStringHashPolicy4hashERKPKc(l: &Lookup) -> HashNumber;
fn _ZN2js17CStringHashPolicy5matchERKPKcS4_(k: &*const i8, l: &Lookup)
-> bool;
}
impl CStringHashPolicy {
#[inline]
pub unsafe extern "C" fn hash(l: &Lookup) -> HashNumber {
_ZN2js17CStringHashPolicy4hashERKPKc(l)
}
#[inline]
pub unsafe extern "C" fn match(k: &*const i8, l: &Lookup) -> bool {
_ZN2js17CStringHashPolicy5matchERKPKcS4_(k, l)
}
}
#[repr(i32)]
#[derive(Copy)]
pub enum MemoryMetrics_hpp_unnamed_1 {
NotLiveGCThing = 0,
IsLiveGCThing = 1,
}
#[repr(C)]
#[derive(Copy)]
pub struct ClassInfo {
pub objectsGCHeap: size_t,
pub objectsMallocHeapSlots: size_t,
pub objectsMallocHeapElementsNonAsmJS: size_t,
pub objectsMallocHeapElementsAsmJS: size_t,
pub objectsNonHeapElementsAsmJS: size_t,
pub objectsNonHeapElementsMapped: size_t,
pub objectsNonHeapCodeAsmJS: size_t,
pub objectsMallocHeapMisc: size_t,
pub shapesGCHeapTree: size_t,
pub shapesGCHeapDict: size_t,
pub shapesGCHeapBase: size_t,
pub shapesMallocHeapTreeTables: size_t,
pub shapesMallocHeapDictTables: size_t,
pub shapesMallocHeapTreeKids: size_t,
pub dummy: i32,
}
impl ::std::default::Default for ClassInfo {
fn default() -> ClassInfo { unsafe { ::std::mem::zeroed() } }
}
extern "C" {
fn _ZN2JS9ClassInfo3addERKS0_(this: *mut ClassInfo, other: &ClassInfo);
fn _ZN2JS9ClassInfo8subtractERKS0_(this: *mut ClassInfo,
other: &ClassInfo);
fn _ZNK2JS9ClassInfo15sizeOfAllThingsEv(this: *mut ClassInfo) -> size_t;
fn _ZNK2JS9ClassInfo9isNotableEv(this: *mut ClassInfo) -> bool;
fn _ZNK2JS9ClassInfo18sizeOfLiveGCThingsEv(this: *mut ClassInfo)
-> size_t;
fn _ZNK2JS9ClassInfo13addToTabSizesEPNS_8TabSizesE(this: *mut ClassInfo,
sizes: *mut TabSizes);
}
impl ClassInfo {
#[inline]
pub unsafe extern "C" fn add(&mut self, other: &ClassInfo) {
_ZN2JS9ClassInfo3addERKS0_(&mut *self, other)
}
#[inline]
pub unsafe extern "C" fn subtract(&mut self, other: &ClassInfo) {
_ZN2JS9ClassInfo8subtractERKS0_(&mut *self, other)
}
#[inline]
pub unsafe extern "C" fn sizeOfAllThings(&mut self) -> size_t {
_ZNK2JS9ClassInfo15sizeOfAllThingsEv(&mut *self)
}
#[inline]
pub unsafe extern "C" fn isNotable(&mut self) -> bool {
_ZNK2JS9ClassInfo9isNotableEv(&mut *self)
}
#[inline]
pub unsafe extern "C" fn sizeOfLiveGCThings(&mut self) -> size_t {
_ZNK2JS9ClassInfo18sizeOfLiveGCThingsEv(&mut *self)
}
#[inline]
pub unsafe extern "C" fn addToTabSizes(&mut self, sizes: *mut TabSizes) {
_ZNK2JS9ClassInfo13addToTabSizesEPNS_8TabSizesE(&mut *self, sizes)
}
}
#[repr(C)]
#[derive(Copy)]
pub struct NotableClassInfo {
pub _base: ClassInfo,
pub className_: *mut i8,
}
impl ::std::default::Default for NotableClassInfo {
fn default() -> NotableClassInfo { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy)]
pub struct CodeSizes {
pub ion: size_t,
pub baseline: size_t,
pub regexp: size_t,
pub other: size_t,
pub unused: size_t,
pub dummy: i32,
}
impl ::std::default::Default for CodeSizes {
fn default() -> CodeSizes { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy)]
pub struct GCSizes {
pub marker: size_t,
pub nurseryCommitted: size_t,
pub nurseryDecommitted: size_t,
pub nurseryMallocedBuffers: size_t,
pub storeBufferVals: size_t,
pub storeBufferCells: size_t,
pub storeBufferSlots: size_t,
pub storeBufferWholeCells: size_t,
pub storeBufferRelocVals: size_t,
pub storeBufferRelocCells: size_t,
pub storeBufferGenerics: size_t,
pub dummy: i32,
}
impl ::std::default::Default for GCSizes {
fn default() -> GCSizes { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy)]
pub struct StringInfo {
pub gcHeapLatin1: size_t,
pub gcHeapTwoByte: size_t,
pub mallocHeapLatin1: size_t,
pub mallocHeapTwoByte: size_t,
pub numCopies: u32,
}
impl ::std::default::Default for StringInfo {
fn default() -> StringInfo { unsafe { ::std::mem::zeroed() } }
}
extern "C" {
fn _ZN2JS10StringInfo3addERKS0_(this: *mut StringInfo,
other: &StringInfo);
fn _ZN2JS10StringInfo8subtractERKS0_(this: *mut StringInfo,
other: &StringInfo);
fn _ZNK2JS10StringInfo9isNotableEv(this: *mut StringInfo) -> bool;
fn _ZNK2JS10StringInfo18sizeOfLiveGCThingsEv(this: *mut StringInfo)
-> size_t;
fn _ZNK2JS10StringInfo13addToTabSizesEPNS_8TabSizesE(this:
*mut StringInfo,
sizes:
*mut TabSizes);
}
impl StringInfo {
#[inline]
pub unsafe extern "C" fn add(&mut self, other: &StringInfo) {
_ZN2JS10StringInfo3addERKS0_(&mut *self, other)
}
#[inline]
pub unsafe extern "C" fn subtract(&mut self, other: &StringInfo) {
_ZN2JS10StringInfo8subtractERKS0_(&mut *self, other)
}
#[inline]
pub unsafe extern "C" fn isNotable(&mut self) -> bool {
_ZNK2JS10StringInfo9isNotableEv(&mut *self)
}
#[inline]
pub unsafe extern "C" fn sizeOfLiveGCThings(&mut self) -> size_t {
_ZNK2JS10StringInfo18sizeOfLiveGCThingsEv(&mut *self)
}
#[inline]
pub unsafe extern "C" fn addToTabSizes(&mut self, sizes: *mut TabSizes) {
_ZNK2JS10StringInfo13addToTabSizesEPNS_8TabSizesE(&mut *self, sizes)
}
}
#[repr(C)]
#[derive(Copy)]
pub struct NotableStringInfo {
pub _base: StringInfo,
pub buffer: *mut i8,
pub length: size_t,
}
impl ::std::default::Default for NotableStringInfo {
fn default() -> NotableStringInfo { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy)]
pub struct ScriptSourceInfo {
pub compressed: size_t,
pub uncompressed: size_t,
pub misc: size_t,
pub numScripts: u32,
}
impl ::std::default::Default for ScriptSourceInfo {
fn default() -> ScriptSourceInfo { unsafe { ::std::mem::zeroed() } }
}
extern "C" {
fn _ZN2JS16ScriptSourceInfo3addERKS0_(this: *mut ScriptSourceInfo,
other: &ScriptSourceInfo);
fn _ZN2JS16ScriptSourceInfo8subtractERKS0_(this: *mut ScriptSourceInfo,
other: &ScriptSourceInfo);
fn _ZNK2JS16ScriptSourceInfo9isNotableEv(this: *mut ScriptSourceInfo)
-> bool;
}
impl ScriptSourceInfo {
#[inline]
pub unsafe extern "C" fn add(&mut self, other: &ScriptSourceInfo) {
_ZN2JS16ScriptSourceInfo3addERKS0_(&mut *self, other)
}
#[inline]
pub unsafe extern "C" fn subtract(&mut self, other: &ScriptSourceInfo) {
_ZN2JS16ScriptSourceInfo8subtractERKS0_(&mut *self, other)
}
#[inline]
pub unsafe extern "C" fn isNotable(&mut self) -> bool {
_ZNK2JS16ScriptSourceInfo9isNotableEv(&mut *self)
}
}
#[repr(C)]
#[derive(Copy)]
pub struct NotableScriptSourceInfo {
pub _base: ScriptSourceInfo,
pub filename_: *mut i8,
}
impl ::std::default::Default for NotableScriptSourceInfo {
fn default() -> NotableScriptSourceInfo {
unsafe { ::std::mem::zeroed() }
}
}
#[repr(C)]
#[derive(Copy)]
pub struct RuntimeSizes {
pub object: size_t,
pub atomsTable: size_t,
pub contexts: size_t,
pub dtoa: size_t,
pub temporary: size_t,
pub interpreterStack: size_t,
pub mathCache: size_t,
pub uncompressedSourceCache: size_t,
pub compressedSourceSet: size_t,
pub scriptData: size_t,
pub scriptSourceInfo: ScriptSourceInfo,
pub code: CodeSizes,
pub gc: GCSizes,
pub allScriptSources: *mut ScriptSourcesHashMap,
pub notableScriptSources: Vector<NotableScriptSourceInfo, ::libc::c_void,
SystemAllocPolicy>,
}
impl ::std::default::Default for RuntimeSizes {
fn default() -> RuntimeSizes { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy)]
pub struct GCThingSizes {
pub object: size_t,
pub script: size_t,
pub lazyScript: size_t,
pub shape: size_t,
pub baseShape: size_t,
pub objectGroup: size_t,
pub string: size_t,
pub symbol: size_t,
pub jitcode: size_t,
pub dummy: i32,
}
impl ::std::default::Default for GCThingSizes {
fn default() -> GCThingSizes { unsafe { ::std::mem::zeroed() } }
}
extern "C" {
fn _ZN2JS12GCThingSizes9addToKindENS_9TraceKindEi(this: *mut GCThingSizes,
kind: TraceKind,
n: intptr_t);
fn _ZN2JS12GCThingSizes8addSizesERKS0_(this: *mut GCThingSizes,
other: &GCThingSizes);
fn _ZNK2JS12GCThingSizes9totalSizeEv(this: *mut GCThingSizes) -> size_t;
}
impl GCThingSizes {
#[inline]
pub unsafe extern "C" fn addToKind(&mut self, kind: TraceKind,
n: intptr_t) {
_ZN2JS12GCThingSizes9addToKindENS_9TraceKindEi(&mut *self, kind, n)
}
#[inline]
pub unsafe extern "C" fn addSizes(&mut self, other: &GCThingSizes) {
_ZN2JS12GCThingSizes8addSizesERKS0_(&mut *self, other)
}
#[inline]
pub unsafe extern "C" fn totalSize(&mut self) -> size_t {
_ZNK2JS12GCThingSizes9totalSizeEv(&mut *self)
}
}
#[repr(C)]
#[derive(Copy)]
pub struct ZoneStats {
pub symbolsGCHeap: size_t,
pub gcHeapArenaAdmin: size_t,
pub lazyScriptsGCHeap: size_t,
pub lazyScriptsMallocHeap: size_t,
pub jitCodesGCHeap: size_t,
pub objectGroupsGCHeap: size_t,
pub objectGroupsMallocHeap: size_t,
pub typePool: size_t,
pub baselineStubsOptimized: size_t,
pub unusedGCThings: GCThingSizes,
pub stringInfo: StringInfo,
pub extra: *mut ::libc::c_void,
pub allStrings: *mut StringsHashMap,
pub notableStrings: Vector<NotableStringInfo, ::libc::c_void,
SystemAllocPolicy>,
pub isTotals: bool,
}
impl ::std::default::Default for ZoneStats {
fn default() -> ZoneStats { unsafe { ::std::mem::zeroed() } }
}
extern "C" {
fn _ZN2JS9ZoneStats11initStringsEP9JSRuntime(this: *mut ZoneStats,
rt: *mut JSRuntime) -> bool;
fn _ZN2JS9ZoneStats8addSizesERKS0_(this: *mut ZoneStats,
other: &ZoneStats);
fn _ZNK2JS9ZoneStats18sizeOfLiveGCThingsEv(this: *mut ZoneStats)
-> size_t;
fn _ZNK2JS9ZoneStats13addToTabSizesEPNS_8TabSizesE(this: *mut ZoneStats,
sizes: *mut TabSizes);
}
impl ZoneStats {
#[inline]
pub unsafe extern "C" fn initStrings(&mut self, rt: *mut JSRuntime)
-> bool {
_ZN2JS9ZoneStats11initStringsEP9JSRuntime(&mut *self, rt)
}
#[inline]
pub unsafe extern "C" fn addSizes(&mut self, other: &ZoneStats) {
_ZN2JS9ZoneStats8addSizesERKS0_(&mut *self, other)
}
#[inline]
pub unsafe extern "C" fn sizeOfLiveGCThings(&mut self) -> size_t {
_ZNK2JS9ZoneStats18sizeOfLiveGCThingsEv(&mut *self)
}
#[inline]
pub unsafe extern "C" fn addToTabSizes(&mut self, sizes: *mut TabSizes) {
_ZNK2JS9ZoneStats13addToTabSizesEPNS_8TabSizesE(&mut *self, sizes)
}
}
#[repr(C)]
#[derive(Copy)]
pub struct CompartmentStats {
pub objectsPrivate: size_t,
pub scriptsGCHeap: size_t,
pub scriptsMallocHeapData: size_t,
pub baselineData: size_t,
pub baselineStubsFallback: size_t,
pub ionData: size_t,
pub typeInferenceTypeScripts: size_t,
pub typeInferenceAllocationSiteTables: size_t,
pub typeInferenceArrayTypeTables: size_t,
pub typeInferenceObjectTypeTables: size_t,
pub compartmentObject: size_t,
pub compartmentTables: size_t,
pub innerViewsTable: size_t,
pub lazyArrayBuffersTable: size_t,
pub objectMetadataTable: size_t,
pub crossCompartmentWrappersTable: size_t,
pub regexpCompartment: size_t,
pub savedStacksSet: size_t,
pub classInfo: ClassInfo,
pub extra: *mut ::libc::c_void,
pub allClasses: *mut ClassesHashMap,
pub notableClasses: Vector<NotableClassInfo, ::libc::c_void,
SystemAllocPolicy>,
pub isTotals: bool,
}
impl ::std::default::Default for CompartmentStats {
fn default() -> CompartmentStats { unsafe { ::std::mem::zeroed() } }
}
extern "C" {
fn _ZN2JS16CompartmentStats11initClassesEP9JSRuntime(this:
*mut CompartmentStats,
rt: *mut JSRuntime)
-> bool;
fn _ZN2JS16CompartmentStats8addSizesERKS0_(this: *mut CompartmentStats,
other: &CompartmentStats);
fn _ZNK2JS16CompartmentStats18sizeOfLiveGCThingsEv(this:
*mut CompartmentStats)
-> size_t;
fn _ZNK2JS16CompartmentStats13addToTabSizesEPNS_8TabSizesE(this:
*mut CompartmentStats,
sizes:
*mut TabSizes);
}
impl CompartmentStats {
#[inline]
pub unsafe extern "C" fn initClasses(&mut self, rt: *mut JSRuntime)
-> bool {
_ZN2JS16CompartmentStats11initClassesEP9JSRuntime(&mut *self, rt)
}
#[inline]
pub unsafe extern "C" fn addSizes(&mut self, other: &CompartmentStats) {
_ZN2JS16CompartmentStats8addSizesERKS0_(&mut *self, other)
}
#[inline]
pub unsafe extern "C" fn sizeOfLiveGCThings(&mut self) -> size_t {
_ZNK2JS16CompartmentStats18sizeOfLiveGCThingsEv(&mut *self)
}
#[inline]
pub unsafe extern "C" fn addToTabSizes(&mut self, sizes: *mut TabSizes) {
_ZNK2JS16CompartmentStats13addToTabSizesEPNS_8TabSizesE(&mut *self,
sizes)
}
}
pub type CompartmentStatsVector =
Vector<CompartmentStats, ::libc::c_void, SystemAllocPolicy>;
pub type ZoneStatsVector =
Vector<ZoneStats, ::libc::c_void, SystemAllocPolicy>;
#[repr(C)]
#[derive(Copy)]
pub struct RuntimeStats {
pub _vftable: *const _vftable_RuntimeStats,
pub gcHeapChunkTotal: size_t,
pub gcHeapDecommittedArenas: size_t,
pub gcHeapUnusedChunks: size_t,
pub gcHeapUnusedArenas: size_t,
pub gcHeapChunkAdmin: size_t,
pub gcHeapGCThings: size_t,
pub runtime: RuntimeSizes,
pub cTotals: CompartmentStats,
pub zTotals: ZoneStats,
pub compartmentStatsVector: CompartmentStatsVector,
pub zoneStatsVector: ZoneStatsVector,
pub currZoneStats: *mut ZoneStats,
pub mallocSizeOf_: MallocSizeOf,
}
impl ::std::default::Default for RuntimeStats {
fn default() -> RuntimeStats { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
pub struct _vftable_RuntimeStats {
pub initExtraCompartmentStats: extern "C" fn(this: *mut ::libc::c_void,
c: *mut JSCompartment,
cstats:
*mut CompartmentStats),
pub initExtraZoneStats: extern "C" fn(this: *mut ::libc::c_void,
zone: *mut Zone,
zstats: *mut ZoneStats),
}
#[repr(C)]
#[derive(Copy)]
pub struct ObjectPrivateVisitor {
pub _vftable: *const _vftable_ObjectPrivateVisitor,
pub getISupports_: GetISupportsFun,
}
impl ::std::default::Default for ObjectPrivateVisitor {
fn default() -> ObjectPrivateVisitor { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
pub struct _vftable_ObjectPrivateVisitor {
pub sizeOfIncludingThis: extern "C" fn(this: *mut ::libc::c_void,
aSupports: *mut nsISupports)
-> size_t,
}
extern "C" {
fn _ZN2js32MemoryReportingSundriesThresholdEv() -> size_t;
fn _ZN2JS19CollectRuntimeStatsEP9JSRuntimePNS_12RuntimeStatsEPNS_20ObjectPrivateVisitorEb(rt:
*mut JSRuntime,
rtStats:
*mut RuntimeStats,
opv:
*mut ObjectPrivateVisitor,
anonymize:
bool)
-> bool;
fn _ZN2JS22SystemCompartmentCountEP9JSRuntime(rt: *mut JSRuntime)
-> size_t;
fn _ZN2JS20UserCompartmentCountEP9JSRuntime(rt: *mut JSRuntime) -> size_t;
fn _ZN2JS19PeakSizeOfTemporaryEPK9JSRuntime(rt: *const JSRuntime)
-> size_t;
fn _ZN2JS12AddSizeOfTabEP9JSRuntimeNS_6HandleIP8JSObjectEEPFjPKvEPNS_20ObjectPrivateVisitorEPNS_8TabSizesE(rt:
*mut JSRuntime,
obj:
HandleObject,
mallocSizeOf:
MallocSizeOf,
opv:
*mut ObjectPrivateVisitor,
sizes:
*mut TabSizes)
-> bool;
}
#[inline]
pub unsafe extern "C" fn MemoryReportingSundriesThreshold() -> size_t {
_ZN2js32MemoryReportingSundriesThresholdEv()
}
#[inline]
pub unsafe extern "C" fn CollectRuntimeStats(rt: *mut JSRuntime,
rtStats: *mut RuntimeStats,
opv: *mut ObjectPrivateVisitor,
anonymize: bool) -> bool {
_ZN2JS19CollectRuntimeStatsEP9JSRuntimePNS_12RuntimeStatsEPNS_20ObjectPrivateVisitorEb(rt,
rtStats,
opv,
anonymize)
}
#[inline]
pub unsafe extern "C" fn SystemCompartmentCount(rt: *mut JSRuntime)
-> size_t {
_ZN2JS22SystemCompartmentCountEP9JSRuntime(rt)
}
#[inline]
pub unsafe extern "C" fn UserCompartmentCount(rt: *mut JSRuntime) -> size_t {
_ZN2JS20UserCompartmentCountEP9JSRuntime(rt)
}
#[inline]
pub unsafe extern "C" fn PeakSizeOfTemporary(rt: *const JSRuntime) -> size_t {
_ZN2JS19PeakSizeOfTemporaryEPK9JSRuntime(rt)
}
#[inline]
pub unsafe extern "C" fn AddSizeOfTab(rt: *mut JSRuntime, obj: HandleObject,
mallocSizeOf: MallocSizeOf,
opv: *mut ObjectPrivateVisitor,
sizes: *mut TabSizes) -> bool {
_ZN2JS12AddSizeOfTabEP9JSRuntimeNS_6HandleIP8JSObjectEEPFjPKvEPNS_20ObjectPrivateVisitorEPNS_8TabSizesE(rt,
obj,
mallocSizeOf,
opv,
sizes)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment