def insertRetrieveTest(): n = 1000000 db = esedb.open(database, 'n', True) data = '0123456789ABCDEF' timer = Stopwatch.StartNew() for i in xrange(n): db[i] = data timer.Stop() print 'Inserted %d records in %s' % (n, timer.Elapsed) (k, v) = db.first() timer = Stopwatch.StartNew() for i in xrange(n): data = db[k] timer.Stop() print 'Retrieved 1 record %d times in %s' % (n, timer.Elapsed) timer = Stopwatch.StartNew() i = 0 for (k, v) in db: i += 1 timer.Stop() print 'Scanned %d records in %s' % (i, timer.Elapsed) keys = db.keys() random.shuffle(keys) timer = Stopwatch.StartNew() for k in keys: v = db[k] timer.Stop() print 'Retrieved %d records in %s' % (len(keys), timer.Elapsed) db.close()
def testColumnStream(): print 'Verifying ColumnStream against MemoryStream' timer = Stopwatch.StartNew() instance = Instance('ColumnStreamTest') instance.Parameters.MaxVerPages = 1024 instance.Parameters.CircularLog = True instance.Init() bookmark = Array.CreateInstance(System.Byte, 255) try: session = Session(instance) dbid = Api.JetCreateDatabase(session, 'ColumnStream.db', '', CreateDatabaseGrbit.OverwriteExisting) Api.JetBeginTransaction(session) tableid = Api.JetCreateTable(session, dbid, 'table', 0, 100) columndef = JET_COLUMNDEF(coltyp=JET_coltyp.LongBinary) columnid = Api.JetAddColumn(session, tableid, 'LvColumn', columndef, None, 0) Api.JetCloseTable(session, tableid) Api.JetCommitTransaction(session, CommitTransactionGrbit.LazyFlush) tableid = Api.JetOpenTable(session, dbid, 'table', None, 0, OpenTableGrbit.None) for i in xrange(64): runtimer = Stopwatch.StartNew() Api.JetBeginTransaction(session) Api.JetPrepareUpdate(session, tableid, JET_prep.Insert) bookmarksize = Api.JetUpdate(session, tableid, bookmark, 255) Api.JetCommitTransaction(session, CommitTransactionGrbit.LazyFlush) Api.JetGotoBookmark(session, tableid, bookmark, bookmarksize) Api.JetBeginTransaction(session) Api.JetPrepareUpdate(session, tableid, JET_prep.Insert) streams = [ MemoryStream(), ColumnStream(session, tableid, columnid) ] randomOperations(64, streams) Api.JetUpdate(session, tableid) Api.JetCommitTransaction(session, CommitTransactionGrbit.LazyFlush) runtimer.Stop() print '\t%s' % runtimer.Elapsed finally: instance.Dispose() timer.Stop() print '%s' % timer.Elapsed
def YaraAll(YaraRules, vtero): Vtero.VerboseLevel = 1 Vtero.DiagOutput = False dumptime = Stopwatch.StartNew() yall = vtero.YaraAll(YaraRules, True, False) print "elapsed " + dumptime.Elapsed.ToString() return yall
def retrieveTest(keys): db = esedb.open(database, 'r') timer = Stopwatch.StartNew() for x in keys: data = db[x] timer.Stop() db.close() return timer.Elapsed
def testMemoryStreams(): print 'Verifying MemoryStreams' stopwatch = Stopwatch.StartNew() for i in xrange(64): streams = [MemoryStream() for x in xrange(2)] randomOperations(128, streams) stopwatch.Stop() print '%s' % stopwatch.Elapsed
def repeatedRetrieveTest(numretrieves): db = esedb.open(database, 'r') (key, data) = db.first() timer = Stopwatch.StartNew() for i in xrange(0, numretrieves): data = db[key] timer.Stop() db.close() return timer.Elapsed
def scanTest(): db = esedb.open(database, 'r') timer = Stopwatch.StartNew() i = 0 for (k, v) in db: i += 1 timer.Stop() db.close() return timer.Elapsed
def insertTest(keys): db = esedb.open(database, 'n', True) data = 'XXXXXXXXXXXXXXXX' timer = Stopwatch.StartNew() for x in keys: db[x] = data timer.Stop() db.close() return timer.Elapsed
def Execute(self, recs): sw = Stopwatch.StartNew() if self.Name == 'copyto.over': copyToRecord(recs, True) elif self.Name == 'copyto.new': copyToRecord(recs, False) sw.Stop() t = TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds) ScriptSupport.SendStatusText( 'Script took %s to complete. List added to clipboard' % t.ToString(), Color.Blue)
def Execute(self, recs): from TESVSnip.UI.Hosting import ScriptSupport from System.Drawing import SystemColors, Color from TESVSnip.UI.Hosting import ScriptSupport sw = Stopwatch.StartNew() print getNPCRaces(recs) #p = copyRecords(recs) #__plugins__.AddRecord(p) # add new plugin sw.Stop() t = TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds) ScriptSupport.SendStatusText('Script took %s to complete' % t.ToString() , Color.Blue)
def testFileStream(): print 'Verifying FileStream against MemoryStream' stopwatch = Stopwatch.StartNew() for i in xrange(128): m = MemoryStream() file = Path.GetTempFileName() f = FileStream(file, FileMode.Open) try: streams = [m, f] randomOperations(128, streams) finally: f.Close() File.Delete(file) stopwatch.Stop() print '%s' % stopwatch.Elapsed
def Execute(self, recs): from TESVSnip.UI.Hosting import ScriptSupport from System.Drawing import SystemColors, Color sw = Stopwatch.StartNew() str = generateItemList(recs) if str: sw.Stop() t = TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds) window = ScriptSupport.CreateTextWindow("Script Output") if window: window.Focus() window.SetText(str) ScriptSupport.SendStatusText( 'Script took %s to complete' % t.ToString(), Color.Blue)
def test(MemList): TotalRunTime = Stopwatch.StartNew() TotalSizeAnalyzed = 0 for MemoryDump in MemList: print " ++++++++++++++++++++++++++++++ ANALYZING INPUT [" + MemoryDump + "] ++++++++++++++++++++++++++++++ " if not File.Exists(MemoryDump): print "Can not find dump to analyze: " + MemoryDump continue copts.FileName = MemoryDump vtero = ScanDump(MemoryDump, copts) TotalSizeAnalyzed += vtero.FileSize print " ++++++++++++++++++++++++++++++ DONE WITH INPUT [" + MemoryDump + "] ++++++++++++++++++++++++++++++ " print " ++++++++++++++++++++++++++++++ ALL DONE... Please explore! ++++++++++++++++++++++++++++++" print "TOTAL RUNTIME: " + TotalRunTime.Elapsed.ToString() + " (seconds), TOTAL DATA ANALYZED: " + TotalSizeAnalyzed.ToString("N") + " bytes." print "SPEED: " + ((TotalSizeAnalyzed / 1024) / ((TotalRunTime.ElapsedMilliseconds / 1000)+1)).ToString("N0") + " KB / second (all phases aggregate time)" return vtero
def addBrepOfSubsetOfFaces_RemoveAt(): rgBrep1 = rgBrep_In.Duplicate() # Create list of non-extracted faces. # This is faster than looping through all faces while testing each. idx_rgFaces_ToRemove = list( set(range(rgBrep1.Faces.Count)) - set(idxFaces)) idx_rgFaces_ToRemove.sort(reverse=True) stopwatch = Stopwatch() stopwatch.Start() [rgBrep1.Faces.RemoveAt(idx) for idx in idx_rgFaces_ToRemove] stopwatch.Stop() if bDebug: print "{} seconds for Faces.RemoveAt".format(stopwatch.Elapsed.TotalSeconds) # Separate any brep shells of modified brep and act based on shell quantity. stopwatch.Restart() rgBreps_per_shell = rg.Brep.CreateBooleanUnion( [rgBrep1], tolerance=0.0, manifoldOnly=False) stopwatch.Stop() if bDebug: print "{} seconds for CreateBooleanUnion".format( stopwatch.Elapsed.TotalSeconds) if rgBreps_per_shell is None: if bDebug: print "Error in attempting to separate brep shells. No objects have been modified." return rgBrep1.Dispose() attr = rdBrep_In.Attributes.Duplicate() if not bRetainLayer: attr.LayerIndex = sc.doc.Layers.CurrentLayerIndex if not bRetainColor: attr.ColorSource = rd.ObjectColorSource.ColorFromLayer stopwatch.Restart() gBreps_1Shell = map(lambda x: sc.doc.Objects.AddBrep(x, attr), rgBreps_per_shell) stopwatch.Stop() if bDebug: print "{:.1f} seconds for AddBrep".format(stopwatch.Elapsed.TotalSeconds) map(lambda x: x.Dispose(), rgBreps_per_shell) return gBreps_1Shell
def Execute(self, recs): sw = Stopwatch.StartNew() str = None if self.Name == 'listweight': str = listNPCWeights(recs) if self.Name == 'modweight': str = modifyNPCWeights(recs) if str: sw.Stop() t = TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds) toClipboard(__window__, str) window = ScriptSupport.CreateTextWindow("Script Output") if window: window.Focus() window.SetText(str) ScriptSupport.SendStatusText( 'Script took %s to complete. List added to clipboard' % t.ToString(), Color.Blue)
import Rhino import Rhino.Geometry as rg import Rhino.Input as ri import scriptcontext as sc from System.Diagnostics import Stopwatch import xBrep_findMatchingFace import xBrep_nakedEdgeLoop import xBrepFace import xBrepFace_extendAtUntrimmedEdge import xBrepFace_removeTrim import xBrepObject import xInput stopwatch = Stopwatch() # One instance will be used for all tests. timeLimit = 0.1 # Occurrences of some methods requiring more time (seconds) than this value will be stated. class Opts: keys = [] values = {} names = {} riOpts = {} riAddOpts = {} stickyKeys = {} def addOptionDouble(key, names, riOpts): return lambda getObj: ri.Custom.GetBaseClass.AddOptionDouble( getObj, englishName=names[key], numberValue=riOpts[key])
import startup import shared.util as util gameDir = util.getGameDirectory() import System from System.Diagnostics import Stopwatch from System import TimeSpan sw = Stopwatch.StartNew() import TESVSnip.Domain import ListItems plugins = TESVSnip.Domain.Model.PluginList.All excludeList = 'RGDL;CLDC;PWAT;SCOL;SCPT;HAIR;REGN;NAVI;WRLD;DIAL;CELL;IMAD;WTHR'.Split( ';') filter = System.Func[str, bool](lambda x: x not in excludeList) pluginList = util.loadMasterPluginIndex() from System import Random rand = Random() pluginName = pluginList.items()[rand.Next(0, len(pluginList) - 1)][0] plugins.AddRecord(TESVSnip.Domain.Model.Plugin(gameDir + pluginName, filter)) #plugins.AddRecord(TESVSnip.Domain.Model.Plugin(gameDir + 'skyrim.esm', filter)) print ListItems.generateItemList(plugins) import ModWeight print ModWeight.listNPCWeights(plugins) print ModWeight.modifyNPCWeights(plugins) sw.Stop()
from inVtero.net import * from inVtero.net.ConsoleUtils import * from System.IO import Directory, File, FileInfo, Path from System.Diagnostics import Stopwatch # Basic option handling copts = ConfigOptions() copts.IgnoreSaveData = True copts.FileName = "C:\\Users\\files\\VMs\\Windows 10 x64-PRO-1703\\Windows 10 x64-PRO-1703-40599dd1.vmem" copts.VersionsToEnable = PTType.GENERIC # To get some additional output copts.VerboseOutput = True copts.VerboseLevel = 1 TotalRunTime = Stopwatch.StartNew() # since we are not ignoring SaveData, this just get's our state from vtero = Scan.Scanit(copts) # Global CollectKernel = False newdir = copts.FileName + ".dumped.latest" topDir = Directory.CreateDirectory(newdir) Vtero.DiagOutput = False proc_arr = vtero.Processes.ToArray() low_proc = proc_arr[0] for proc in proc_arr: if proc.CR3Value < low_proc.CR3Value: low_proc = proc
def ScanDump(MemoryDump, copts): MemoryDumpSize = FileInfo(MemoryDump).Length copts.FileName = MemoryDump # Check StopWatch runTime = Stopwatch.StartNew() # since we are not ignoring SaveData, this just get's our state from # the underlying protobuf, pretty fast vtero = Scan.Scanit(copts) proc_arr = vtero.Processes.ToArray() low_proc = proc_arr[0] for proc in proc_arr: if proc.CR3Value < low_proc.CR3Value: low_proc = proc proc = low_proc print "Assumed Kernel Proc: " + proc.ToString() vtero.KernelProc = proc #vtero.CheckpointSaveState() proc.MemAccess = Mem(vtero.MemAccess) #swModScan = Stopwatch.StartNew() # by default this will scan for kernel symbols if vtero.KVS is None: kvs = proc.ScanAndLoadModules() vtero.KVS = kvs vtero.CheckpointSaveState() else: proc.LoadSymbols() #apply some setup kMinorVer = proc.GetSymValueLong("NtBuildNumber") & 0xffff Console.ForegroundColor = ConsoleColor.Cyan print "kernel build: " + kMinorVer.ToString() # Use dynamic typing to walk EPROCES logicalList = vtero.WalkProcList(proc) print "Physical Proc Count: " + proc_arr.Count.ToString() #for pproc in proc_arr: # print pproc if logicalList is not None: print "Logical Proc Count: " + logicalList.Count.ToString() for proc in logicalList: # This is due to a structure member name change pre win 8 if proc.Dictionary.ContainsKey("VadRoot.BalancedRoot.RightChild"): proc.VadRoot = proc.Dictionary[ "VadRoot.BalancedRoot.RightChild"] print proc.ImagePath + " : " + proc.Dictionary[ "Pcb.DirectoryTableBase"].ToString( "X") + " : " + proc.VadRoot.ToString( "X") + " : " + proc.UniqueProcessId.ToString("X") Console.ForegroundColor = ConsoleColor.Green print "checking that all logical processes exist in the physical list." # Miss list mostly bad for yellow printing for proc in logicalList: found = False for hwproc in proc_arr: if proc.Dictionary[ "Pcb.DirectoryTableBase"] == hwproc.CR3Value: found = True #print "Found logical proc[" + hwproc.CR3Value.ToString("X") + "] in physical array" if found == False: Console.ForegroundColor = ConsoleColor.Yellow if proc.VadRoot == 0: Console.ForegroundColor = ConsoleColor.Green print "An expected, ", print "Logical miss for " + proc.ImagePath + " : " + proc.Dictionary[ "Pcb.DirectoryTableBase"].ToString( "X") + " : " + proc.VadRoot.ToString( "X") + " : " + proc.UniqueProcessId.ToString("X") print "Checking that all physical processes exist in the logical list" for hwproc in proc_arr: found = False for proc in logicalList: if proc.Dictionary[ "Pcb.DirectoryTableBase"] == hwproc.CR3Value: found = True #print "Found physical proc[" + proc.Dictionary["Pcb.DirectoryTableBase"].ToString("X") + "] in logical array" if found == False: Console.ForegroundColor = ConsoleColor.Yellow hwmiss.append(hwproc) print "physical miss for " + hwproc.ToString() Console.ForegroundColor = ConsoleColor.White print "PART RUNTIME: " + runTime.Elapsed.ToString( ) + " (seconds), INPUT DUMP SIZE: " + MemoryDumpSize.ToString( "N") + " bytes." print "SPEED: " + ((MemoryDumpSize / 1024) / ((runTime.ElapsedMilliseconds / 1000) + 1)).ToString( "N0") + " KB / second (all phases aggregate time)" return vtero
def addFromSubsetOfFaces(rhBrep, idxFaces, bAddOnlyMonofaces=True, bRetainLayer=True, bRetainColor=True, bDebug=False): """ """ rdBrep_In = coerceBrepObject(rhBrep) if rdBrep_In is None: return rgBrep_In = rdBrep_In.BrepGeometry if not rgBrep_In.IsValid: return def addBrepOfSubsetOfFaces_JoinBreps(): # Duplicate faces to their own breps to be joined. rgBreps1 = [] # Faces (breps) to be duplicated. for i in idxFaces: rgFace = rgBrep_In.Faces[i] rgBrep_1Face = rgFace.DuplicateFace(True) if rgBrep_1Face is None: if bDebug: print "Face {} could not be duplicated as a brep!".format(i) return None rgBreps1.append(rgBrep_1Face) # Join monoface breps. # Using a tight tolerance to rejoin only existing shared edges. fTol_Join = 1e-9 rgBreps_Joined = rg.Brep.JoinBreps(rgBreps1, tolerance=fTol_Join) if rgBreps_Joined is None: if bDebug: print "Joining breps failed!" return for rgB in rgBreps_Joined: if not rgB.IsValid: if bDebug: print "Joined brep not valid. Exiting..." return if any(b.Faces.Count > 1 for b in rgBreps_Joined): # Separate any brep shells of modified brep and act based on shell quantity. rgBreps_per_shell = rg.Brep.CreateBooleanUnion( rgBreps_Joined, tolerance=0.0, manifoldOnly=False) if rgBreps_per_shell is None: if bDebug: print "Error in attempting to separate brep shells. No objects have been modified." return else: # Skipped attempting to Boolean union monoface breps in case any contact are in contact with one another. rgBreps_per_shell = rgBreps_Joined[:] attr = rdBrep_In.Attributes.Duplicate() if not bRetainLayer: attr.LayerIndex = sc.doc.Layers.CurrentLayerIndex if not bRetainColor: attr.ColorSource = rd.ObjectColorSource.ColorFromLayer gBreps_1Shell = map(lambda x: sc.doc.Objects.AddBrep(x, attr), rgBreps_per_shell) map(lambda x: x.Dispose(), rgBreps_per_shell) return gBreps_1Shell def addBrepOfSubsetOfFaces_RemoveAt(): rgBrep1 = rgBrep_In.Duplicate() # Create list of non-extracted faces. # This is faster than looping through all faces while testing each. idx_rgFaces_ToRemove = list( set(range(rgBrep1.Faces.Count)) - set(idxFaces)) idx_rgFaces_ToRemove.sort(reverse=True) stopwatch = Stopwatch() stopwatch.Start() [rgBrep1.Faces.RemoveAt(idx) for idx in idx_rgFaces_ToRemove] stopwatch.Stop() if bDebug: print "{} seconds for Faces.RemoveAt".format(stopwatch.Elapsed.TotalSeconds) # Separate any brep shells of modified brep and act based on shell quantity. stopwatch.Restart() rgBreps_per_shell = rg.Brep.CreateBooleanUnion( [rgBrep1], tolerance=0.0, manifoldOnly=False) stopwatch.Stop() if bDebug: print "{} seconds for CreateBooleanUnion".format( stopwatch.Elapsed.TotalSeconds) if rgBreps_per_shell is None: if bDebug: print "Error in attempting to separate brep shells. No objects have been modified." return rgBrep1.Dispose() attr = rdBrep_In.Attributes.Duplicate() if not bRetainLayer: attr.LayerIndex = sc.doc.Layers.CurrentLayerIndex if not bRetainColor: attr.ColorSource = rd.ObjectColorSource.ColorFromLayer stopwatch.Restart() gBreps_1Shell = map(lambda x: sc.doc.Objects.AddBrep(x, attr), rgBreps_per_shell) stopwatch.Stop() if bDebug: print "{:.1f} seconds for AddBrep".format(stopwatch.Elapsed.TotalSeconds) map(lambda x: x.Dispose(), rgBreps_per_shell) return gBreps_1Shell nFaces = rgBrep_In.Faces.Count # If brep has only 1 face, return the brep's GUID. if nFaces == 1: return [rdBrep_In.Id] idxFaces = list(set(idxFaces)) if not bAddOnlyMonofaces: stopwatch = Stopwatch() # Create brep(s) of extracted faces using method chosen by whether number of # extracted faces is less or more than the remaining number of faces. if len(idxFaces) < nFaces // 2 : stopwatch.Restart() gBreps1_Extracted = addBrepOfSubsetOfFaces_JoinBreps() stopwatch.Stop() if bDebug: print "{} seconds for addBrepOfSubsetOfFaces_JoinBreps".format( stopwatch.Elapsed.TotalSeconds) if gBreps1_Extracted is not None: return gBreps1_Extracted if bDebug: print "addBrepOfSubsetOfFaces_JoinBreps returned None." # Since addBrepOfSubsetOfFaces_JoinBreps failed, will try RemoveAt instead. # Either the number of faces to add > half the total number of faces in the brep or addBrepOfSubsetOfFaces_JoinBreps had returned None. stopwatch.Restart() gBreps1_Extracted = addBrepOfSubsetOfFaces_RemoveAt() stopwatch.Stop() if bDebug: print "{} seconds for addBrepOfSubsetOfFaces_RemoveAt".format( stopwatch.Elapsed.TotalSeconds) if gBreps1_Extracted is not None: return gBreps1_Extracted if bDebug: print "addBrepOfSubsetOfFaces_RemoveAt returned None." # Add only monoface breps. attr = rdBrep_In.Attributes.Duplicate() if not bRetainLayer: attr.LayerIndex = sc.doc.Layers.CurrentLayerIndex if not bRetainColor: attr.ColorSource = rd.ObjectColorSource.ColorFromLayer gBreps1_Extracted = [] for idx in idxFaces: rgFace = rgBrep_In.Faces[idx] # Duplicate face to its own brep. rgBrep1 = rgFace.DuplicateFace(duplicateMeshes=True) if not rgBrep1.IsValid: gBrep1 = None else: gBrep1 = sc.doc.Objects.AddBrep(rgBrep1, attr) if gBrep1 is None: s = "Brep face {} from {} could not be added to document.".format( idx, rdBrep_In.Id) print s rc = rs.MessageBox( s + "\nContinue extracting faces, skipping this one?", buttons=4, title="xBrepObject.addFromSubsetOfFaces") if rc is not None and rc == 6: continue #if not bDebug: rs.DeleteObjects(gBreps1_Extracted) return gBreps1_Extracted.append(gBrep1) rgBrep1.Dispose() return gBreps1_Extracted
import csv import datetime import os import os.path as op import clr clr.AddReference("RevitAPI") import Autodesk.Revit.UI from Autodesk.Revit.DB import FilteredElementCollector as Fec from Autodesk.Revit.DB import FilteredWorksetCollector as Fwc from Autodesk.Revit.DB import BuiltInCategory, ModelPathUtils, WorksetKind from System.Diagnostics import Stopwatch # TODO check for existing folders and csv # TODO create/update csv from check modules stopwatch = Stopwatch() stopwatch.Start() sqft_sqm = 10.764 doc = __revit__.ActiveUIDocument.Document def count_views(view_type): collector = Fec(doc).OfClass(Autodesk.Revit.DB.View).ToElements() counter = 0 for view in collector: if not view.IsTemplate: if view.ViewType.ToString() == view_type: counter += 1 return str(counter)
def __init__(self): #self.name = name self.time = Stopwatch.StartNew() self.time.Start()
else: self.fib_list.append(self.fib_list[-2] + self.fib_list[-1]) def F(): a, b = 0, 1 yield a yield b while True: a, b = b, a + b yield b if __name__ == '__main__': sw = Stopwatch() fib_calc = Fib() f = F() sw.Start() print fib_calc(18) sw.Stop() time_taken = sw.ElapsedMilliseconds print time_taken sw.Start() print[f.next() for i in xrange(18)] sw.Stop()
print "An expected, ", print "physical miss for " + proc.ImagePath + " : " + proc.Dictionary[ "Pcb.DirectoryTableBase"].ToString( "X") + " : " + proc.VadRoot.ToString( "X") + " : " + proc.UniqueProcessId.ToString("X") print "PART RUNTIME: " + runTime.Elapsed.ToString( ) + " (seconds), INPUT DUMP SIZE: " + MemoryDumpSize.ToString( "N") + " bytes." print "SPEED: " + ((MemoryDumpSize / 1024) / ((runTime.ElapsedMilliseconds / 1000) + 1)).ToString( "N0") + " KB / second (all phases aggregate time)" return vtero # Check StopWatch TotalRunTime = Stopwatch.StartNew() TotalSizeAnalyzed = 0 for MemoryDump in MemList: print " ++++++++++++++++++++++++++++++ ANALYZING INPUT [" + MemoryDump + "] ++++++++++++++++++++++++++++++ " if not File.Exists(MemoryDump): print "Can not find dump to analyze: " + MemoryDump continue vtero = ScanDump(MemoryDump) TotalSizeAnalyzed += vtero.FileSize print " ++++++++++++++++++++++++++++++ DONE WITH INPUT [" + MemoryDump + "] ++++++++++++++++++++++++++++++ " print "TOTAL RUNTIME: " + TotalRunTime.Elapsed.ToString( ) + " (seconds), TOTAL DATA ANALYZED: " + TotalSizeAnalyzed.ToString( "N") + " bytes." print "SPEED: " + ((TotalSizeAnalyzed / 1024) /
sympath = "SRV*http://msdl.microsoft.com/download/symbols" # Basic option handling # This script can be pretty chatty to stdout # copts = ConfigOptions() copts.IgnoreSaveData = False copts.FileName = MemoryDump copts.VersionsToEnable = PTType.GENERIC # To get some additional output copts.VerboseOutput = True copts.VerboseLevel = 1 Vtero.VerboseOutput = True Vtero.DiagOutput = True runTime = Stopwatch.StartNew() # since we are not ignoring SaveData, this just get's our state from # the underlying protobuf, pretty fast vtero = Scan.Scanit(copts) proc_arr = vtero.Processes.ToArray() low_proc = proc_arr[0] for proc in proc_arr: if proc.CR3Value < low_proc.CR3Value: low_proc = proc proc = low_proc swModScan = Stopwatch.StartNew() # if we have save state we can skip this entirely
clr.AddReference("DHI.Generic.MikeZero.EUM") clr.AddReference("System") import System from System import Array from System.Diagnostics import Stopwatch from DHI.Generic.MikeZero import eumUnit, eumItem, eumQuantity from DHI.Generic.MikeZero.DFS import * from DHI.Generic.MikeZero.DFS.dfs123 import * infile = "..\..\TestData\data_ndr_roese.dfs0" # Load the file dfs0File = DfsFileFactory.DfsGenericOpen(infile) # Read times and data timer = Stopwatch() timer.Start() t = [] data = [] for ii in xrange(dfs0File.ItemInfo.Count): data.append([]) for it in xrange(dfs0File.FileInfo.TimeAxis.NumberOfTimeSteps): for ii in xrange(dfs0File.ItemInfo.Count): itemData = dfs0File.ReadItemTimeStep(ii + 1, it) if (ii == 0): t.append(itemData.Time) data[ii].append(itemData.Data[0]) timer.Stop() dfs0File.Close()