LCOV - differential code coverage report
Current view: top level - src/interfaces/ecpg/test/thread - descriptor.pgc (source / functions) Coverage Total Hit CBC
Current: Differential Code Coverage HEAD vs 15 Lines: 100.0 % 12 12 12
Current Date: 2023-04-08 17:13:01 Functions: 100.0 % 2 2 2
Baseline: 15 Line coverage date bins:
Baseline Date: 2023-04-08 15:09:40 (240..) days: 100.0 % 12 12 12
Legend: Lines: hit not hit Function coverage date bins:
(240..) days: 100.0 % 2 2 2

 Age         Owner                  TLA  Line data    Source code
                                  1                 : #ifdef ENABLE_THREAD_SAFETY
                                  2                 : #ifdef WIN32
                                  3                 : #define WIN32_LEAN_AND_MEAN
                                  4                 : #include <windows.h>
                                  5                 : #include <process.h>
                                  6                 : #include <locale.h>
                                  7                 : #else
                                  8                 : #include <pthread.h>
                                  9                 : #endif
                                 10                 : #endif
                                 11                 : #include <stdio.h>
                                 12                 : 
                                 13                 : #define THREADS     16
                                 14                 : #define REPEATS     50000
                                 15                 : 
                                 16                 : EXEC SQL include sqlca;
                                 17                 : EXEC SQL whenever sqlerror sqlprint;
                                 18                 : EXEC SQL whenever not found sqlprint;
                                 19                 : 
                                 20                 : #if defined(ENABLE_THREAD_SAFETY) && defined(WIN32)
                                 21                 : static unsigned __stdcall fn(void* arg)
                                 22                 : #else
 5668 meskes                     23 CBC          16 : static void* fn(void* arg)
                                 24                 : #endif
                                 25                 : {
                                 26                 :     int i;
                                 27                 : 
                                 28          800016 :     for (i = 1; i <= REPEATS; ++i)
                                 29                 :     {
                                 30          800000 :         EXEC SQL ALLOCATE DESCRIPTOR mydesc;
                                 31          800000 :         EXEC SQL DEALLOCATE DESCRIPTOR mydesc;
                                 32          800000 :     }
                                 33                 : 
                                 34              16 :     return 0;
                                 35                 : }
                                 36                 : 
 5072                            37               1 : int main ()
                                 38                 : {
                                 39                 : #ifdef ENABLE_THREAD_SAFETY
                                 40                 :     int i;
                                 41                 : #ifdef WIN32
                                 42                 :     HANDLE threads[THREADS];
                                 43                 : #else
                                 44                 :     pthread_t threads[THREADS];
                                 45                 : #endif
                                 46                 : 
                                 47                 : #ifdef WIN32
                                 48                 :     for (i = 0; i < THREADS; ++i)
                                 49                 :     {
                                 50                 :         unsigned id;
                                 51                 :         threads[i] = (HANDLE)_beginthreadex(NULL, 0, fn, NULL, 0, &id);
                                 52                 :     }
                                 53                 : 
                                 54                 :     WaitForMultipleObjects(THREADS, threads, TRUE, INFINITE);
                                 55                 :     for (i = 0; i < THREADS; ++i)
                                 56                 :         CloseHandle(threads[i]);
                                 57                 : #else
 5668                            58              17 :     for (i = 0; i < THREADS; ++i)
                                 59              16 :         pthread_create(&threads[i], NULL, fn, NULL);
                                 60              17 :     for (i = 0; i < THREADS; ++i)
                                 61              16 :         pthread_join(threads[i], NULL);
                                 62                 : #endif
                                 63                 : #else
                                 64                 :     fn(NULL);
                                 65                 : #endif
                                 66                 : 
                                 67               1 :     return 0;
                                 68                 : }
        

Generated by: LCOV version v1.16-55-g56c0a2a