Çalışan Programları İzleme
** Bir çalışan programı nasıl izlenir**
Aşağıdaki örnek kod, bir çalışan programı nasıl izleneceğini göstermektedir. Bu kod, Çalışma Kitabı ile ilgili kodun çalışmasını izlemek için kullanılabilir. Basitçe, izleme nesnesi oluşturmak için SystemTimeInterruptMonitor sınıfını kullanın, çalışma parametrelerine eklemek için SetInterruptMonitor işlevini kullanın ve ardından beklenen kesinti süresini (milisaniye cinsinden) ayarlamak için StartMonitor işlevini kullanın. İzlenen kodun çalışma süresi beklenen süreyi aşarsa, program kesilecek ve bir istisna atılacaktır.
Örnek Kod
Aspose::Cells::Startup(); | |
SystemTimeInterruptMonitor monitor(false); | |
LoadOptions lopts; | |
lopts.SetInterruptMonitor((AbstractInterruptMonitor*) & monitor); | |
monitor.StartMonitor(1000); //time limit is 1 second | |
Workbook wb(u"Large.xlsx", lopts); | |
//if the time cost of loading the template file exceeds one second, interruption will be required and exception will be thrown here | |
//otherwise starts to monitor the save procedure | |
monitor.StartMonitor(1500); //time limit is 1.5 seconds | |
wb.Save(u"result.xlsx"); | |
Aspose::Cells::Cleanup(); |