Commits

Tuukka Norri committed e7f3f0b

Combined rows recorded by the fetch duration probe
- Now we get only one line per fetch.

  • Participants
  • Parent commits 522cf2f
  • Branches PGTS-NG

Comments (0)

Files changed (3)

File BaseTenTemplate.tracetemplate

Binary file modified.

File Sources/BXDatabaseContext.m

 		NSArray* keys = [anObject keysIncludedInQuery: aKey];
 		
 		if (BASETEN_BEGIN_FETCH_ENABLED ())
+			BASETEN_BEGIN_FETCH ();
+		
+	    retval = [mDatabaseInterface fireFault: anObject keys: keys error: &localError];
+		
+		if (BASETEN_END_FETCH_ENABLED ())
 		{
 			BXEntityDescription* entity = [anObject entity];
 			char* schema_s = strdup ([[entity schemaName] UTF8String]);
 			char* table_s = strdup ([[entity name] UTF8String]);
-			BASETEN_BEGIN_FETCH (self, schema_s, table_s);
+			BASETEN_END_FETCH (self, schema_s, table_s, 1);
 			free (schema_s);
 			free (table_s);
 		}
 		
-	    retval = [mDatabaseInterface fireFault: anObject keys: keys error: &localError];
-		
-		if (BASETEN_END_FETCH_ENABLED ())
-			BASETEN_END_FETCH (1);
-		
 		if (YES == retval)
 			[anObject awakeFromFetchIfNeeded];
 	    BXHandleError (error, localError);
 			}
 			
 			if (BASETEN_BEGIN_FETCH_ENABLED ())
-			{
-				char* schema_s = strdup ([[entity schemaName] UTF8String]);
-				char* table_s = strdup ([[entity name] UTF8String]);
-				BASETEN_BEGIN_FETCH (self, schema_s, table_s);
-				free (schema_s);
-				free (table_s);
-			}
-			
+				BASETEN_BEGIN_FETCH ();
+							
 			retval = [mDatabaseInterface executeFetchForEntity: entity withPredicate: predicate 
 											   returningFaults: returnFaults 
 														 class: [entity databaseObjectClass] 
 														 error: &localError];
 			
 			if (BASETEN_END_FETCH_ENABLED ())
-				BASETEN_END_FETCH ([retval count]);
+			{
+				char* schema_s = strdup ([[entity schemaName] UTF8String]);
+				char* table_s = strdup ([[entity name] UTF8String]);
+				BASETEN_END_FETCH (self, schema_s, table_s, [retval count]);
+				free (schema_s);
+				free (table_s);
+			}
 			
 			if (nil == localError)
 			{

File Sources/BXProbes.d

 
 provider BaseTen
 {
-	probe begin_fetch (void* context, char* schema, char* table);
-	probe end_fetch (long count);
+	probe begin_fetch ();
+	probe end_fetch (void* context, char* schema, char* table, long count);
 
 	probe received_pg_notice (void* connection, char* message);