/[xmltv_parser]/trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs
ViewVC logotype

Diff of /trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs	2013/03/16 22:02:01	197
+++ trunk/GBPVRProgramDatabaseFixer/SQLLITE.cs	2013/03/16 22:25:44	199
@@ -848,26 +848,32 @@
         public void UpdateGBPVRPrograms(List<IPROGRAMME> programs)
         {
             int ChunkSize = 500;
-            var ChunkList = programs.Chunk<IPROGRAMME>(ChunkSize).ToList();
+            var ChunkList = programs.Chunk<IPROGRAMME>(ChunkSize);
 
-            int total = programs.Count;
-            int index = 0;
+            double total = programs.Count;
+            double index = 0;
             double progress = 0;
-            Stopwatch st = new Stopwatch();
-            st.Start();
+            Stopwatch st1 = new Stopwatch();
+            st1.Start();
             foreach (var p in ChunkList)
             {
+                Stopwatch st2 = new Stopwatch();
+                st2.Start();
                 progress = 100.0 * (index / total);
                 //gLog.Info.WriteLine("Inserting {0} gbpvr programs.", p.Count);   
                 if (!InsertProgramEntryDatabase(p.ToList()))
                 {
                     gLog.Error.WriteLine("Failed to insert one or more program(s)");
                 }
+                st2.Stop();
+                gLog.Warn.WriteLine("    operation took: {0:0.00000} seconds", st2.Elapsed.TotalSeconds);
+                gLog.Warn.WriteLine(System.Environment.NewLine);
                 gLog.ReportProgress(this, new ReportProgressEventArgs((int)progress, string.Format("Inserting GBPVR Programs: {0:00}%", (int)progress)));
-                index += p.Count();
+                index += (double)p.Count();
+                
             }
-            st.Stop();
-            gLog.Warn.WriteLine("    operation took: {0:0.00000} minutes", st.Elapsed.TotalMinutes);
+            st1.Stop();
+            gLog.Warn.WriteLine("    operation took: {0:0.00000} minutes overall", st1.Elapsed.TotalMinutes);
         }
 
         private bool RemoveAllProgramDatabaseEntries()

 

  ViewVC Help
Powered by ViewVC 1.1.22