OLD | NEW |
1 /* ***** BEGIN LICENSE BLOCK ***** | 1 /* ***** BEGIN LICENSE BLOCK ***** |
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
3 * | 3 * |
4 * The contents of this file are subject to the Mozilla Public License Version | 4 * The contents of this file are subject to the Mozilla Public License Version |
5 * 1.1 (the "License"); you may not use this file except in compliance with | 5 * 1.1 (the "License"); you may not use this file except in compliance with |
6 * the License. You may obtain a copy of the License at | 6 * the License. You may obtain a copy of the License at |
7 * http://www.mozilla.org/MPL/ | 7 * http://www.mozilla.org/MPL/ |
8 * | 8 * |
9 * Software distributed under the License is distributed on an "AS IS" basis, | 9 * Software distributed under the License is distributed on an "AS IS" basis, |
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 int nssdbg_prof_size = sizeof(nssdbg_prof_data)/sizeof(nssdbg_prof_data[0]); | 895 int nssdbg_prof_size = sizeof(nssdbg_prof_data)/sizeof(nssdbg_prof_data[0]); |
896 | 896 |
897 | 897 |
898 static void nssdbg_finish_time(PRInt32 fun_number, PRIntervalTime start) | 898 static void nssdbg_finish_time(PRInt32 fun_number, PRIntervalTime start) |
899 { | 899 { |
900 PRIntervalTime ival; | 900 PRIntervalTime ival; |
901 PRIntervalTime end = PR_IntervalNow(); | 901 PRIntervalTime end = PR_IntervalNow(); |
902 | 902 |
903 ival = end-start; | 903 ival = end-start; |
904 /* sigh, lie to PRAtomic add and say we are using signed values */ | 904 /* sigh, lie to PRAtomic add and say we are using signed values */ |
905 PR_AtomicAdd((PRInt32 *)&nssdbg_prof_data[fun_number].time, (PRInt32)ival); | 905 PR_ATOMIC_ADD((PRInt32 *)&nssdbg_prof_data[fun_number].time, (PRInt32)ival); |
906 } | 906 } |
907 | 907 |
908 static void nssdbg_start_time(PRInt32 fun_number, PRIntervalTime *start) | 908 static void nssdbg_start_time(PRInt32 fun_number, PRIntervalTime *start) |
909 { | 909 { |
910 PR_AtomicIncrement((PRInt32 *)&nssdbg_prof_data[fun_number].calls); | 910 PR_ATOMIC_INCREMENT((PRInt32 *)&nssdbg_prof_data[fun_number].calls); |
911 *start = PR_IntervalNow(); | 911 *start = PR_IntervalNow(); |
912 } | 912 } |
913 | 913 |
914 #define COMMON_DEFINITIONS \ | 914 #define COMMON_DEFINITIONS \ |
915 CK_RV rv; \ | 915 CK_RV rv; \ |
916 PRIntervalTime start | 916 PRIntervalTime start |
917 | 917 |
918 CK_RV NSSDBGC_Initialize( | 918 CK_RV NSSDBGC_Initialize( |
919 CK_VOID_PTR pInitArgs | 919 CK_VOID_PTR pInitArgs |
920 ) | 920 ) |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 CK_RV NSSDBGC_OpenSession( | 1205 CK_RV NSSDBGC_OpenSession( |
1206 CK_SLOT_ID slotID, | 1206 CK_SLOT_ID slotID, |
1207 CK_FLAGS flags, | 1207 CK_FLAGS flags, |
1208 CK_VOID_PTR pApplication, | 1208 CK_VOID_PTR pApplication, |
1209 CK_NOTIFY Notify, | 1209 CK_NOTIFY Notify, |
1210 CK_SESSION_HANDLE_PTR phSession | 1210 CK_SESSION_HANDLE_PTR phSession |
1211 ) | 1211 ) |
1212 { | 1212 { |
1213 COMMON_DEFINITIONS; | 1213 COMMON_DEFINITIONS; |
1214 | 1214 |
1215 PR_AtomicIncrement((PRInt32 *)&numOpenSessions); | 1215 PR_ATOMIC_INCREMENT((PRInt32 *)&numOpenSessions); |
1216 maxOpenSessions = PR_MAX(numOpenSessions, maxOpenSessions); | 1216 maxOpenSessions = PR_MAX(numOpenSessions, maxOpenSessions); |
1217 PR_LOG(modlog, 1, ("C_OpenSession")); | 1217 PR_LOG(modlog, 1, ("C_OpenSession")); |
1218 PR_LOG(modlog, 3, (fmt_slotID, slotID)); | 1218 PR_LOG(modlog, 3, (fmt_slotID, slotID)); |
1219 PR_LOG(modlog, 3, (fmt_flags, flags)); | 1219 PR_LOG(modlog, 3, (fmt_flags, flags)); |
1220 PR_LOG(modlog, 3, (" pApplication = 0x%p", pApplication)); | 1220 PR_LOG(modlog, 3, (" pApplication = 0x%p", pApplication)); |
1221 PR_LOG(modlog, 3, (" Notify = 0x%x", Notify)); | 1221 PR_LOG(modlog, 3, (" Notify = 0x%x", Notify)); |
1222 PR_LOG(modlog, 3, (" phSession = 0x%p", phSession)); | 1222 PR_LOG(modlog, 3, (" phSession = 0x%p", phSession)); |
1223 nssdbg_start_time(FUNC_C_OPENSESSION,&start); | 1223 nssdbg_start_time(FUNC_C_OPENSESSION,&start); |
1224 rv = module_functions->C_OpenSession(slotID, | 1224 rv = module_functions->C_OpenSession(slotID, |
1225 flags, | 1225 flags, |
1226 pApplication, | 1226 pApplication, |
1227 Notify, | 1227 Notify, |
1228 phSession); | 1228 phSession); |
1229 nssdbg_finish_time(FUNC_C_OPENSESSION,start); | 1229 nssdbg_finish_time(FUNC_C_OPENSESSION,start); |
1230 log_handle(4, " *phSession = 0x%x", *phSession); | 1230 log_handle(4, " *phSession = 0x%x", *phSession); |
1231 log_rv(rv); | 1231 log_rv(rv); |
1232 return rv; | 1232 return rv; |
1233 } | 1233 } |
1234 | 1234 |
1235 CK_RV NSSDBGC_CloseSession( | 1235 CK_RV NSSDBGC_CloseSession( |
1236 CK_SESSION_HANDLE hSession | 1236 CK_SESSION_HANDLE hSession |
1237 ) | 1237 ) |
1238 { | 1238 { |
1239 COMMON_DEFINITIONS; | 1239 COMMON_DEFINITIONS; |
1240 | 1240 |
1241 PR_AtomicDecrement((PRInt32 *)&numOpenSessions); | 1241 PR_ATOMIC_DECREMENT((PRInt32 *)&numOpenSessions); |
1242 PR_LOG(modlog, 1, ("C_CloseSession")); | 1242 PR_LOG(modlog, 1, ("C_CloseSession")); |
1243 log_handle(3, fmt_hSession, hSession); | 1243 log_handle(3, fmt_hSession, hSession); |
1244 nssdbg_start_time(FUNC_C_CLOSESESSION,&start); | 1244 nssdbg_start_time(FUNC_C_CLOSESESSION,&start); |
1245 rv = module_functions->C_CloseSession(hSession); | 1245 rv = module_functions->C_CloseSession(hSession); |
1246 nssdbg_finish_time(FUNC_C_CLOSESESSION,start); | 1246 nssdbg_finish_time(FUNC_C_CLOSESESSION,start); |
1247 log_rv(rv); | 1247 log_rv(rv); |
1248 return rv; | 1248 return rv; |
1249 } | 1249 } |
1250 | 1250 |
1251 CK_RV NSSDBGC_CloseAllSessions( | 1251 CK_RV NSSDBGC_CloseAllSessions( |
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2734 fprintf(outfile,"%25s %10d %10d%2s\n", "Totals", total_calls, | 2734 fprintf(outfile,"%25s %10d %10d%2s\n", "Totals", total_calls, |
2735 pr_total_time, type); | 2735 pr_total_time, type); |
2736 fprintf(outfile,"\n\nMaximum number of concurrent open sessions: %d\n\n", | 2736 fprintf(outfile,"\n\nMaximum number of concurrent open sessions: %d\n\n", |
2737 maxOpenSessions); | 2737 maxOpenSessions); |
2738 fflush (outfile); | 2738 fflush (outfile); |
2739 if (outfile != stdout) { | 2739 if (outfile != stdout) { |
2740 fclose(outfile); | 2740 fclose(outfile); |
2741 } | 2741 } |
2742 } | 2742 } |
2743 | 2743 |
OLD | NEW |