Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 14 for perf_counter (0.12 seconds)

  1. docs/en/docs/tutorial/middleware.md

    {* ../../docs_src/middleware/tutorial001_py310.py hl[10,12:13] *}
    
    /// tip
    
    Here we use [`time.perf_counter()`](https://docs.python.org/3/library/time.html#time.perf_counter) instead of `time.time()` because it can be more precise for these use cases. 🤓
    
    ///
    
    ## Multiple middleware execution order { #multiple-middleware-execution-order }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 3.9K bytes
    - Click Count (0)
  2. docs/zh-hant/docs/tutorial/middleware.md

    也可以在產生出 `response` 之後、回傳之前執行程式碼。
    
    例如,你可以新增一個自訂標頭 `X-Process-Time`,其內容為處理請求並產生回應所花費的秒數:
    
    {* ../../docs_src/middleware/tutorial001_py310.py hl[10,12:13] *}
    
    /// tip
    
    這裡我們使用 [`time.perf_counter()`](https://docs.python.org/3/library/time.html#time.perf_counter) 而不是 `time.time()`,因為在這些用例中它可能更精確。🤓
    
    ///
    
    ## 多個中介軟體的執行順序 { #multiple-middleware-execution-order }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 3.7K bytes
    - Click Count (0)
  3. docs_src/middleware/tutorial001_py310.py

    from fastapi import FastAPI, Request
    
    app = FastAPI()
    
    
    @app.middleware("http")
    async def add_process_time_header(request: Request, call_next):
        start_time = time.perf_counter()
        response = await call_next(request)
        process_time = time.perf_counter() - start_time
        response.headers["X-Process-Time"] = str(process_time)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 365 bytes
    - Click Count (0)
  4. docs/pt/docs/tutorial/middleware.md

    {* ../../docs_src/middleware/tutorial001_py310.py hl[10,12:13] *}
    
    /// tip | Dica
    
    Aqui usamos [`time.perf_counter()`](https://docs.python.org/3/library/time.html#time.perf_counter) em vez de `time.time()` porque ele pode ser mais preciso para esses casos de uso. 🤓
    
    ///
    
    ## Ordem de execução de múltiplos middlewares { #multiple-middleware-execution-order }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:43 GMT 2026
    - 4.2K bytes
    - Click Count (0)
  5. docs/uk/docs/tutorial/middleware.md

    {* ../../docs_src/middleware/tutorial001_py310.py hl[10,12:13] *}
    
    /// tip
    
    Тут ми використовуємо [`time.perf_counter()`](https://docs.python.org/3/library/time.html#time.perf_counter) замість `time.time()` оскільки він може бути більш точним для таких випадків. 🤓
    
    ///
    
    ## Порядок виконання кількох middleware { #multiple-middleware-execution-order }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:27:41 GMT 2026
    - 6.1K bytes
    - Click Count (0)
  6. docs/es/docs/tutorial/middleware.md

    {* ../../docs_src/middleware/tutorial001_py310.py hl[10,12:13] *}
    
    /// tip | Consejo
    
    Aquí usamos [`time.perf_counter()`](https://docs.python.org/3/library/time.html#time.perf_counter) en lugar de `time.time()` porque puede ser más preciso para estos casos de uso. 🤓
    
    ///
    
    ## Orden de ejecución con múltiples middlewares { #multiple-middleware-execution-order }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:15:55 GMT 2026
    - 4.1K bytes
    - Click Count (0)
  7. docs/zh/docs/tutorial/middleware.md

    也可以在生成 `response` 之后、返回之前添加代码。
    
    例如,你可以添加一个自定义请求头 `X-Process-Time`,其值为处理请求并生成响应所花费的秒数:
    
    {* ../../docs_src/middleware/tutorial001_py310.py hl[10,12:13] *}
    
    /// tip
    
    这里我们使用 [`time.perf_counter()`](https://docs.python.org/3/library/time.html#time.perf_counter) 而不是 `time.time()`,因为在这类场景中它可能更精确。🤓
    
    ///
    
    ## 多个中间件的执行顺序 { #multiple-middleware-execution-order }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 3.7K bytes
    - Click Count (0)
  8. docs/tr/docs/tutorial/middleware.md

    {* ../../docs_src/middleware/tutorial001_py310.py hl[10,12:13] *}
    
    /// tip | İpucu
    
    Burada [`time.perf_counter()`](https://docs.python.org/3/library/time.html#time.perf_counter) yerine `time.time()` kullanıyoruz, çünkü bu kullanım senaryolarında daha hassas olabilir. 🤓
    
    ///
    
    ## Birden Fazla Middleware Çalıştırma Sırası { #multiple-middleware-execution-order }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 07:53:17 GMT 2026
    - 4.3K bytes
    - Click Count (0)
  9. docs/ru/docs/tutorial/middleware.md

    {* ../../docs_src/middleware/tutorial001_py310.py hl[10,12:13] *}
    
    /// tip | Совет
    
    Мы используем [`time.perf_counter()`](https://docs.python.org/3/library/time.html#time.perf_counter) вместо `time.time()` для обеспечения большей точности в таких случаях. 🤓
    
    ///
    
    ## Порядок выполнения нескольких middleware { #multiple-middleware-execution-order }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:56:20 GMT 2026
    - 6.1K bytes
    - Click Count (0)
  10. docs/fr/docs/tutorial/middleware.md

    {* ../../docs_src/middleware/tutorial001_py310.py hl[10,12:13] *}
    
    /// tip | Astuce
    
    Ici, nous utilisons [`time.perf_counter()`](https://docs.python.org/3/library/time.html#time.perf_counter) au lieu de `time.time()` car cela peut être plus précis pour ces cas d’usage. 🤓
    
    ///
    
    ## Ordre d’exécution de plusieurs middlewares { #multiple-middleware-execution-order }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:37:13 GMT 2026
    - 4.4K bytes
    - Click Count (0)
Back to Top