**(UndefinedFunctionError)函数Profile.run_test / 0未定义(模块配置文件不可用)

时间:2018-03-07 16:51:13

标签: elixir phoenix-framework mix

我正在尝试使用profile.fprof配置我的Phoenix服务器。这是我使用的命令行:

PORT=4000 MIX_ENV=prod time mix profile.fprof --callers=true \
        --sort=own --details -e "Profile.run_test" phx.server

但它与上述消息崩溃了。这是输出:

17:48:05.158 function=start/2 line=15 [info] Starting Hammer with backend 'Elixir.Hammer.Backend.ETS'
17:48:05.595 function=start_link/3 line=100 [info] Running Web.Endpoint with Cowboy using http://:::4000
Warmup...
** (UndefinedFunctionError) function Profile.run_test/0 is undefined (module Profile is not available)
    Profile.run_test()
    (mix) lib/mix/tasks/profile.fprof.ex:147: Mix.Tasks.Profile.Fprof.profile_and_analyse/2
    (mix) lib/mix/tasks/profile.fprof.ex:140: Mix.Tasks.Profile.Fprof.profile/2
    (elixir) lib/enum.ex:678: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:678: Enum.each/2
        2.91 real         1.80 user         0.75 sys

所以我的问题是:我做错了什么?

在意识到我只是在黑暗中拍摄(感谢@Dogbert)后,我尝试了以下内容:

 time mix profile.fprof --callers=true --sort=own --details \
           -e "MyApp.Endpoint" phx.server

但这只会生成以下内容(并退出):

10:08:33.592 function=start/2 line=15 [info] Starting Hammer with backend 'Elixir.Hammer.Backend.ETS'
10:08:34.000 function=start_link/3 line=100 [info] Running MyApp.Endpoint with Cowboy using http://:::4000
Warmup...
Reading trace data...

End of trace!
Processing data...
Creating output...
Done!

                                                                   CNT    ACC (ms)    OWN (ms)
Total                                                                3       0.015       0.015

:undefined                                                           0       0.015       0.010
  :fprof.apply_start_stop/4                                          0       0.015       0.010  <--
    anonymous fn/0 in :elixir_compiler_1.__FILE__/1                  1       0.003       0.003
    :fprof."-apply_start_stop/4-after$^1/0-0-"/3                     1       0.002       0.002

:fprof.apply_start_stop/4                                            1       0.003       0.003
  anonymous fn/0 in :elixir_compiler_1.__FILE__/1                    1       0.003       0.003  <--

:fprof.apply_start_stop/4                                            1       0.002       0.002
  :fprof."-apply_start_stop/4-after$^1/0-0-"/3                       1       0.002       0.002  <--
    :suspend                                                         1       0.000       0.000

  :undefined                                                         0       0.000       0.000  <--
    :fprof.apply_start_stop/4                                        0       0.015       0.010

:fprof."-apply_start_stop/4-after$^1/0-0-"/3                         1       0.000       0.000
  :suspend                                                           1       0.000       0.000  <--

----------------------------------------------------------------------------------------------------
<0.73.0>                                                             3                   0.015


:undefined                                                           0       0.015       0.010
  :fprof.apply_start_stop/4                                          0       0.015       0.010  <--
    anonymous fn/0 in :elixir_compiler_1.__FILE__/1                  1       0.003       0.003
    :fprof."-apply_start_stop/4-after$^1/0-0-"/3                     1       0.002       0.002

:fprof.apply_start_stop/4                                            1       0.003       0.003
  anonymous fn/0 in :elixir_compiler_1.__FILE__/1                    1       0.003       0.003  <--

:fprof.apply_start_stop/4                                            1       0.002       0.002
  :fprof."-apply_start_stop/4-after$^1/0-0-"/3                       1       0.002       0.002  <--
    :suspend                                                         1       0.000       0.000

  :undefined                                                         0       0.000       0.000  <--
    :fprof.apply_start_stop/4                                        0       0.015       0.010

:fprof."-apply_start_stop/4-after$^1/0-0-"/3                         1       0.000       0.000
  :suspend                                                           1       0.000       0.000  <--
        3.01 real         1.86 user         0.79 sys

0 个答案:

没有答案