2. Calculs des différents temps d'exécution

Logs are also a good way to gather details about execution times of some Webcampak components.

For example:

11 May 2012 - 11:54:04 - gphoto(1-1267): Capture: Gphoto: Start Capture
11 May 2012 - 11:54:11 - gphoto(1-1267): New file is in location /capt0000.jpg on the camera
Saving file as /home/webcampak/webcampak/sources/source1/tmp/20120511115404.jpg
Deleting file /capt0000.jpg on the camera

11 May 2012 - 11:54:11 - gphoto(1-1267): Deleting 'capt0000.jpg' from folder '/'...

11 May 2012 - 11:54:11 - gphoto(1-1267): Capture: Check File: Successful

We can see on this example that picture capture takes 7 seconds (11:54:11 - 11:54:04), including:

11 May 2012 - 11:54:17 - gphoto(1-1267): FTP: Upload Archive
11 May 2012 - 11:54:17 - gphoto(1-1267): FTP: Server: s001.webcampak.com Directory:  /tmp/20120511/ Filename: 20120511115404.jpg Active: no Login: source10 
11 May 2012 - 11:54:20 - gphoto(1-1267): FTP: Creation of  /tmp/20120511/ directory
11 May 2012 - 11:54:21 - gphoto(1-1267): FTP: Creation of  /tmp/20120511/1336751657.15/ directory
11 May 2012 - 11:54:21 - gphoto(1-1267): FTP: Transfering file, Try:(1/3)
11 May 2012 - 11:54:55 - gphoto(1-1267): FTP: STOR  20120511115404.jpg 
11 May 2012 - 11:54:56 - gphoto(1-1267): FTP: Remote size: 3566523 / Local size: 3566523
11 May 2012 - 11:54:56 - gphoto(1-1267): FTP: File successfully sent to remote FTP

On the above sample we can extract two additional details: transfer time and upload bandwidth.

The overall picture transfer took 39s (11:54:56 - 11:54:17).

As mentioned in the logs, files are uploaded to a temporary directory and then moved to their definitive place. This way, is transfer is corrupted you will not end up with a partial picture in the system.

Effective bandwidth can be calculated by dividing picture size by transfer time. In this particular situation, we have 3566523 / 39 = 91449 bytes per seconds = 91 KB/s

It would be advised in this situation not to use a capture rate faster than 39s as the bandwidth will not be sufficient to transfer all picture. It is likely to end up with a saturation of the link, and of the system (after some time)

11 May 2012 - 11:54:56 - gphoto(1-1267): DiskManagement: Delete temporary files
11 May 2012 - 11:54:56 - gphoto(1-1267): Capture: Overall capture time: 52 seconds
11 May 2012 - 11:54:56 - gphoto(1-1267): -----------------------------------------------------------------------

Finally, overall capture time is 52 seconds which should be considered the minimum capture rate in this particular situation.