@@ -5,7 +5,7 @@ import * as path from 'path';
55import { getTspClient } from "../utils/backend-tsp-client-provider" ;
66import { QueryHelper } from "tsp-typescript-client" ;
77
8- export const exportCSV = async ( outputID : string = 'org.eclipse.tracecompass.internal.provisional.tmf.core.model.events.TmfEventTableDataProvider' ) => {
8+ export const exportCSV = async ( outputID : string ) => {
99
1010 // Helper FUnctions
1111 const REQUEST_SIZE = 1000 ;
@@ -71,7 +71,7 @@ export const exportCSV = async (outputID: string = 'org.eclipse.tracecompass.int
7171
7272 try {
7373 // 1) Resolve headers
74- progress . report ( { message : 'Fetching column headers…' , increment : 5 } ) ;
74+ progress . report ( { message : 'Fetching column headers…' , increment : 2 } ) ;
7575 // todo fix
7676 const headersResp = await tsp . fetchTableColumns ( activeData . UUID , outputID , QueryHelper . query ( ) ) ;
7777 const headersModel = headersResp . getModel ( ) ?. model ;
@@ -82,11 +82,15 @@ export const exportCSV = async (outputID: string = 'org.eclipse.tracecompass.int
8282 const headerNames : string [ ] = headersModel . map ( ( c : { name : string } ) => c . name ) ;
8383
8484 // 2) Compute absolute timestamps for selection
85- const START_TIME = BigInt ( absoluteRange . start ) + BigInt ( selectionRange . start ) ;
86- const END_TIME = BigInt ( absoluteRange . start ) + BigInt ( selectionRange . end ) ;
85+ const t1 = BigInt ( absoluteRange . start ) + BigInt ( selectionRange . start ) ;
86+ const t2 = BigInt ( absoluteRange . start ) + BigInt ( selectionRange . end ) ;
87+
88+ // Normalize
89+ const START_TIME = t1 < t2 ? t1 : t2 ;
90+ const END_TIME = t1 < t2 ? t2 : t1 ;
8791
8892 // 3) Resolve start/end indices by time (like your POC)
89- progress . report ( { message : 'Resolving table indices…' , increment : 10 } ) ;
93+ progress . report ( { message : 'Resolving table indices…' , increment : 2 } ) ;
9094
9195 const indexBody = ( requestedTime : bigint ) => ( {
9296 requested_times : [ requestedTime ] ,
@@ -153,7 +157,7 @@ export const exportCSV = async (outputID: string = 'org.eclipse.tracecompass.int
153157 } ;
154158
155159 let processed = 0 ;
156- progress . report ( { message : `Exporting ${ totalRows . toLocaleString ( ) } rows…` , increment : 10 } ) ;
160+ progress . report ( { message : `Exporting ${ totalRows . toLocaleString ( ) } rows…` , increment : 2 } ) ;
157161
158162 while ( rowsLeft > 0 && ! token . isCancellationRequested ) {
159163 // Advance iterators for the *next* request before awaiting current
@@ -241,4 +245,4 @@ export const queryForOutputType = async () => {
241245
242246 return selection ?. id ;
243247
244- }
248+ }
0 commit comments