You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 rivejä
1.6 KiB

4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
  1. %% Copyright (c) 2017-Present Pivotal Software, Inc. All rights reserved.
  2. %%
  3. %% This package, Looking Glass, is double-licensed under the Mozilla
  4. %% Public License 1.1 ("MPL") and the Apache License version 2
  5. %% ("ASL"). For the MPL, please see LICENSE-MPL-RabbitMQ. For the ASL,
  6. %% please see LICENSE-APACHE2.
  7. %%
  8. %% This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
  9. %% either express or implied. See the LICENSE file for specific language governing
  10. %% rights and limitations of this software.
  11. %%
  12. %% If you have any questions regarding licensing, please contact us at
  13. %% info@rabbitmq.com.
  14. -module(lg_raw_console_tracer).
  15. -export([start_link/2]).
  16. -export([init/1]).
  17. -export([loop/1]).
  18. -export([system_continue/3]).
  19. -export([system_terminate/4]).
  20. -export([system_code_change/4]).
  21. start_link(_Nth, _Opts) ->
  22. Pid = proc_lib:spawn_link(?MODULE, init, [self()]),
  23. {ok, Pid}.
  24. init(Parent) ->
  25. %% Store all messages off the heap to avoid unnecessary GC.
  26. process_flag(message_queue_data, off_heap),
  27. loop(Parent).
  28. loop(Parent) ->
  29. receive
  30. {system, From, Request} ->
  31. sys:handle_system_msg(Request, From, Parent, ?MODULE, [], Parent);
  32. Msg0 ->
  33. %% Convert the event's monotonic time to its system time.
  34. Msg = setelement(3, Msg0, erlang:time_offset(microsecond) + element(3, Msg0)),
  35. erlang:display(Msg),
  36. loop(Parent)
  37. end.
  38. system_continue(_, _, Parent) ->
  39. loop(Parent).
  40. -spec system_terminate(any(), _, _, _) -> no_return().
  41. system_terminate(Reason, _, _, _) ->
  42. exit(Reason).
  43. system_code_change(Misc, _, _, _) ->
  44. {ok, Misc}.