@@ -54,18 +54,22 @@ void SnapshotCrawlerCache::createNativeTypeTable()
5454 " typeIndex INTEGER PRIMARY KEY," \
5555 " name TEXT NOT NULL," \
5656 " nativeBaseTypeArrayIndex INTEGER," \
57- " managedTypeArrayIndex INTEGER);" );
57+ " managedTypeArrayIndex INTEGER," \
58+ " instanceCount INTEGER," \
59+ " instanceMemory INTEGER);" );
5860}
5961
6062void SnapshotCrawlerCache::insert (Array<PackedNativeType> &nativeTypes)
6163{
62- insert<PackedNativeType>(" INSERT INTO nativeTypes VALUES (?1, ?2, ?3, ?4);" ,
64+ insert<PackedNativeType>(" INSERT INTO nativeTypes VALUES (?1, ?2, ?3, ?4, ?5, ?6 );" ,
6365 nativeTypes, [](PackedNativeType &nt, sqlite3_stmt *stmt)
6466 {
6567 sqlite3_bind_int (stmt, 1 , nt.typeIndex );
6668 sqlite3_bind_text (stmt, 2 , nt.name ->c_str (), (int )nt.name ->size (), SQLITE_STATIC );
6769 sqlite3_bind_int64 (stmt, 3 , nt.nativeBaseTypeArrayIndex );
6870 sqlite3_bind_int (stmt, 4 , nt.managedTypeArrayIndex );
71+ sqlite3_bind_int (stmt, 5 , nt.instanceCount );
72+ sqlite3_bind_int (stmt, 6 , nt.instanceMemory );
6973 });
7074}
7175
@@ -118,7 +122,10 @@ void SnapshotCrawlerCache::createTypeTable()
118122 " typeIndex INTEGER PRIMARY KEY," \
119123 " typeInfoAddress INTEGER," \
120124 " nativeTypeArrayIndex INTEGER," \
121- " fields INTEGER);" );
125+ " fields INTEGER," \
126+ " instanceCount INTEGER," \
127+ " instanceMemory INTEGER," \
128+ " nativeMemory INTEGER);" );
122129}
123130
124131void SnapshotCrawlerCache::createFieldTable ()
@@ -133,7 +140,7 @@ void SnapshotCrawlerCache::createFieldTable()
133140
134141void SnapshotCrawlerCache::insert (Array<TypeDescription> &types)
135142{
136- insert<TypeDescription>(" INSERT INTO types VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12);" ,
143+ insert<TypeDescription>(" INSERT INTO types VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15 );" ,
137144 types, [this ](TypeDescription &t, sqlite3_stmt *stmt)
138145 {
139146 sqlite3_bind_int (stmt, 1 , t.arrayRank );
@@ -151,6 +158,9 @@ void SnapshotCrawlerCache::insert(Array<TypeDescription> &types)
151158 sqlite3_bind_int64 (stmt, 10 , t.typeInfoAddress );
152159 sqlite3_bind_int (stmt, 11 , t.nativeTypeArrayIndex );
153160 sqlite3_bind_int (stmt, 12 , t.fields ->size );
161+ sqlite3_bind_int (stmt, 13 , t.instanceCount );
162+ sqlite3_bind_int (stmt, 14 , t.instanceMemory );
163+ sqlite3_bind_int (stmt, 15 , t.nativeMemory );
154164 });
155165
156166 // type fields
@@ -337,6 +347,8 @@ MemorySnapshotCrawler &SnapshotCrawlerCache::read(const char *uuid)
337347 nt.name = new string ((char *)sqlite3_column_text (stmt, 1 ));
338348 nt.nativeBaseTypeArrayIndex = sqlite3_column_int (stmt, 2 );
339349 nt.managedTypeArrayIndex = sqlite3_column_int (stmt, 3 );
350+ nt.instanceCount = sqlite3_column_int (stmt, 4 );
351+ nt.instanceMemory = sqlite3_column_int (stmt, 5 );
340352 });
341353 __sampler.end (); // read_native_types
342354
@@ -390,6 +402,9 @@ MemorySnapshotCrawler &SnapshotCrawlerCache::read(const char *uuid)
390402 mt.fields = new Array<FieldDescription>(size);
391403 }
392404 }
405+ mt.instanceCount = sqlite3_column_int (stmt, 12 );
406+ mt.instanceMemory = sqlite3_column_int (stmt, 13 );
407+ mt.nativeMemory = sqlite3_column_int (stmt, 14 );
393408 });
394409 __sampler.begin (" read_type_fields" );
395410 int32_t typeIndex = 0 ;
0 commit comments