@@ -492,6 +492,83 @@ impl Table for RustcCompilation {
492492 }
493493}
494494
495+
496+ struct RuntimePstat ;
497+
498+ #[ derive( Serialize ) ]
499+ struct RuntimePstatRow {
500+ series : i32 ,
501+ aid : i32 ,
502+ cid : i32 ,
503+ value : f64 ,
504+ }
505+
506+ impl Table for RuntimePstat {
507+ fn name ( ) -> & ' static str {
508+ "runtime_pstat"
509+ }
510+
511+ fn sqlite_attributes ( ) -> & ' static str {
512+ "series, aid, cid, value"
513+ }
514+
515+ fn postgres_attributes ( ) -> & ' static str {
516+ "series, aid, cid, value"
517+ }
518+
519+ fn postgres_generated_id_attribute ( ) -> Option < & ' static str > {
520+ None
521+ }
522+
523+ fn write_postgres_csv_row < W : Write > ( writer : & mut csv:: Writer < W > , row : & rusqlite:: Row ) {
524+ writer
525+ . serialize ( PstatRow {
526+ series : row. get ( 0 ) . unwrap ( ) ,
527+ aid : row. get ( 1 ) . unwrap ( ) ,
528+ cid : row. get ( 2 ) . unwrap ( ) ,
529+ value : row. get ( 3 ) . unwrap ( ) ,
530+ } )
531+ . unwrap ( ) ;
532+ }
533+ }
534+
535+ struct RuntimePstatSeries ;
536+
537+ #[ derive( Serialize ) ]
538+ struct RuntimePstatSeriesRow < ' a > {
539+ id : i32 ,
540+ benchmark : & ' a str ,
541+ metric : & ' a str ,
542+ }
543+
544+ impl Table for RuntimePstatSeries {
545+ fn name ( ) -> & ' static str {
546+ "runtime_pstat_series"
547+ }
548+
549+ fn sqlite_attributes ( ) -> & ' static str {
550+ "id, benchmark, metric"
551+ }
552+
553+ fn postgres_attributes ( ) -> & ' static str {
554+ "id, benchmark, metric"
555+ }
556+
557+ fn postgres_generated_id_attribute ( ) -> Option < & ' static str > {
558+ Some ( "id" )
559+ }
560+
561+ fn write_postgres_csv_row < W : Write > ( writer : & mut csv:: Writer < W > , row : & rusqlite:: Row ) {
562+ writer
563+ . serialize ( RuntimePstatSeriesRow {
564+ id : row. get ( 0 ) . unwrap ( ) ,
565+ benchmark : row. get_ref ( 1 ) . unwrap ( ) . as_str ( ) . unwrap ( ) ,
566+ metric : row. get_ref ( 2 ) . unwrap ( ) . as_str ( ) . unwrap ( ) ,
567+ } )
568+ . unwrap ( ) ;
569+ }
570+ }
571+
495572// `Nullable<T>` helps to work around the fact that the `csv` crate (and the CSV
496573// format in general) doesn't distinguish between nulls and empty strings, while
497574// the Postgres CSV format does.
@@ -620,6 +697,8 @@ async fn main() -> anyhow::Result<()> {
620697 copy :: < PullRequestBuild > ( & sqlite_tx, & postgres_tx) . await ;
621698 copy :: < RawSelfProfile > ( & sqlite_tx, & postgres_tx) . await ;
622699 copy :: < RustcCompilation > ( & sqlite_tx, & postgres_tx) . await ;
700+ copy :: < RuntimePstatSeries > ( & sqlite_tx, & postgres_tx) . await ;
701+ copy :: < RuntimePstat > ( & sqlite_tx, & postgres_tx) . await ;
623702 enable_table_triggers ( & postgres_tx, & tables) . await ;
624703
625704 // This is overly paranoid, but don't commit the Postgres transaction until
0 commit comments