master
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24#include "first.h"
26#define NUM_THREADS 100
28#ifdef _WIN32
29static DWORD WINAPI t3026_run_thread(void *ptr)
30{
31 CURLcode *result = ptr;
33 *result = curl_global_init(CURL_GLOBAL_ALL);
34 if(*result == CURLE_OK)
35 curl_global_cleanup();
37 return 0;
38}
40static CURLcode test_lib3026(const char *URL)
41{
42 CURLcode results[NUM_THREADS];
43 HANDLE thread_handles[NUM_THREADS];
44 unsigned tid_count = NUM_THREADS, i;
45 CURLcode result = CURLE_OK;
46 curl_version_info_data *ver;
47 (void)URL;
49 ver = curl_version_info(CURLVERSION_NOW);
50 if((ver->features & CURL_VERSION_THREADSAFE) == 0) {
51 curl_mfprintf(stderr, "%s:%d On Windows but the "
52 "CURL_VERSION_THREADSAFE feature flag is not set\n",
53 __FILE__, __LINE__);
54 return TEST_ERR_MAJOR_BAD;
55 }
57 for(i = 0; i < tid_count; i++) {
58 HANDLE th;
59 results[i] = CURL_LAST; /* initialize with invalid value */
60 th = CreateThread(NULL, 0, t3026_run_thread, &results[i], 0, NULL);
61 if(!th) {
62 curl_mfprintf(stderr, "%s:%d Could not create thread, "
63 "GetLastError 0x%08lx\n",
64 __FILE__, __LINE__, GetLastError());
65 tid_count = i;
66 result = TEST_ERR_MAJOR_BAD;
67 goto cleanup;
68 }
69 thread_handles[i] = th;
70 }
72cleanup:
73 for(i = 0; i < tid_count; i++) {
74 WaitForSingleObject(thread_handles[i], INFINITE);
75 CloseHandle(thread_handles[i]);
76 if(results[i] != CURLE_OK) {
77 curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
78 "with code %d (%s)\n", __FILE__, __LINE__,
79 i, (int)results[i], curl_easy_strerror(results[i]));
80 result = TEST_ERR_MAJOR_BAD;
81 }
82 }
84 return result;
85}
87#elif defined(HAVE_THREADS_POSIX)
89static void *t3026_run_thread(void *ptr)
90{
91 CURLcode *result = ptr;
93 *result = curl_global_init(CURL_GLOBAL_ALL);
94 if(*result == CURLE_OK)
95 curl_global_cleanup();
97 return NULL;
98}
100static CURLcode test_lib3026(const char *URL)
101{
102 CURLcode results[NUM_THREADS];
103 pthread_t tids[NUM_THREADS];
104 unsigned tid_count = NUM_THREADS, i;
105 CURLcode result = CURLE_OK;
106 curl_version_info_data *ver;
107 (void)URL;
109 ver = curl_version_info(CURLVERSION_NOW);
110 if((ver->features & CURL_VERSION_THREADSAFE) == 0) {
111 curl_mfprintf(stderr, "%s:%d Have pthread but the "
112 "CURL_VERSION_THREADSAFE feature flag is not set\n",
113 __FILE__, __LINE__);
114 return TEST_ERR_MAJOR_BAD;
115 }
117 for(i = 0; i < tid_count; i++) {
118 int res;
119 results[i] = CURL_LAST; /* initialize with invalid value */
120 res = pthread_create(&tids[i], NULL, t3026_run_thread, &results[i]);
121 if(res) {
122 curl_mfprintf(stderr, "%s:%d Could not create thread, errno %d\n",
123 __FILE__, __LINE__, res);
124 tid_count = i;
125 result = TEST_ERR_MAJOR_BAD;
126 goto cleanup;
127 }
128 }
130cleanup:
131 for(i = 0; i < tid_count; i++) {
132 pthread_join(tids[i], NULL);
133 if(results[i] != CURLE_OK) {
134 curl_mfprintf(stderr, "%s:%d thread[%u]: curl_global_init() failed,"
135 "with code %d (%s)\n", __FILE__, __LINE__,
136 i, (int)results[i], curl_easy_strerror(results[i]));
137 result = TEST_ERR_MAJOR_BAD;
138 }
139 }
141 return result;
142}
144#else /* without pthread or Windows, this test does not work */
145static CURLcode test_lib3026(const char *URL)
146{
147 curl_version_info_data *ver;
148 (void)URL;
150 ver = curl_version_info(CURLVERSION_NOW);
151 if((ver->features & CURL_VERSION_THREADSAFE) != 0) {
152 curl_mfprintf(stderr, "%s:%d No pthread but the "
153 "CURL_VERSION_THREADSAFE feature flag is set\n",
154 __FILE__, __LINE__);
155 return TEST_ERR_MAJOR_BAD;
156 }
157 return CURLE_OK;
158}
159#endif
Diagnostics4 git calls · 36 ms
CallStatusSizeTime036 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2001.4 KiB · hit30 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=30 git.response.bytes=1471 git.response.cache=HIT git.response.duration_ms=30 git.fetch.wants=f072dee282fbf05043680ee12d57e6274c5e92c9 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1471 git.pkt.payload.max=1450 git.sideband.band1.bytes=1449 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e339dbdb5ff162
- Request
- 3a93eb6b…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format