I saw some functions here that measure CPU and thread usage: 

http://lifeisagraph.com/2011/04/24/debugging-clojure.html

That looked good, so I imported them into my app. I've done this before and 
not had a problem with it. 

For logging, I like to use the Timbre library: 

https://github.com/ptaoussanis/timbre

And then I thought I should call the thread-measuring function and hand its 
return value to timbre. And suddenly the info that I'm logging to the 
terminal became a mangled mess of strangely intermingled text. Can anyone 
suggest why this is happening? 

((applyapply
 str
 " at the start of  persistrst-sessi
on -data-to-datab"as<eop,t "io ouarnt   cvtpaluhu eea =nsd'tt athrehtar 
teoeafrd 'd>eTlh eetaete-uro<l/do-pssteioans>s"iogns
,   eour c pu alnd thoreado usagke losoks l liikeke  this:t "his
 : ""
< option value='music'>Music</option>"(debug/thread-top))
(debug/thread-top)
  )
[" at the[ start o"f  ade"l<eoptteio-no vladlu-es='easlsl-ikoinndss,' 
>Aolulr ki ndcsp</to pttihone> "]s]ta
rt of  peu2013-Mar-12 23:03:21 -0400 MacBook-Pro.local DEBUG 
[kiosks-clojure.core] - in get-options-for-select-box:  ["<option v\
alue='dance'>Dance</option>" "<option value='theater'>Theater</option>" 
"<option value='music'>Music</option>" "<option value='all-kinds'>\
All kinds</option>"]
r sainstd- thsreesasdi ouns-adgaet al-o"to2ok0-s1d 3l-iMkaer a-tt1ah2ib 
sa2:s3 e:[,03 31o:u42412 7-7r00 40000 c \"pLua wDarenesdnt crteohs\
yr-JeMaaavcdaB ouVosMka\"ge  2l2o o#k<-TPhrroe.aldo s clailk eD EtBhUiGs :[ 
k[i3o1s4k4Ts2h-7rce7la0od0j[uDrees.tcrooryeJ]a"va
VM,05 ,\"maiDne]s>t]ro[4y7J"a3i1vna6V0 0Mg0\"e t\"- 2o2p t#i<oTnhsr-efaodrT 
-hTsrheerlaedc-t1-1b\"ox:  1"9
#<Thea[dr[[eDaeds tTrhoryeJa"da[<vToaphrtVeiMoa,nd5- 
,1vm1aa,luien=]'>d]a[n4c6e0'21>0D0a0n c\"e</Tohprteiaodn->1"1\" 19 
#<Thr5e,maadin]> ]\
T[h3r0e8a9d4[0T0h0r e\"ad-T1h1r,ead-12\" 20 #<Thread Thread[Th
r  ead-12,5,main]>][51,3m4a2i7n0]0>0] [3\"0894000 \"Thread-12\""<Tohread- 
1230\" #< 2Th1 re#<aTd hTrehared aTdh[rTehad[Tread-12,5,main]>][\
13400000 \"hread-13,5,maiTnh]r>e]a[960000 d\"-13q\"tp5 2211 
8#8<9pT0thi0or5ne-a1 dv1a 
 lTuSehe=rl'teehaceadtt[oerTr'h>rTheeaadte-r1<3/,op5\
t,imona>i"n]>
]  [960000\"0 \"q t1p15 2#1<8T8h9r0e0a5d- 1T1h rSeealde[cqtotrp052\"18 
81910 0#5<-T1h1r Seealde Tchtroera0d,[5q,tpm5a2i1n8]8>9]0[0854-9101\
 0S0e l\"ectqort0p,55,main]>][849000 \"qtp52121889080859-01035 -A1c3ce 
pAtcocre0pt oSer0l ecSteClehcatnCnehalnConnenleCoctnnore@c0t".<oo0r\
p.@t0i0o..n0 0:v.a3l00u.e00=0':1m3u\"s0i0c0'1>M\"usic <1/3o pt# i<o1nT3>h" 
r#e<a


At least some of this mangled text is coming from this function, which is 
called at startup and then runs in its own thread, repeating endlessly:

(defn persist-session-data-to-database []
  (timbre/spy :debug (apply str " at the start of 
 persist-session-data-to-database, our cpu and thread usage looks like 
this: " (debug/thread-top)))
  (try   
    (let [documents-to-be-persisted (get-data-to-be-persisted)]
      (doseq [[k v] documents-to-be-persisted]
        (monger/persist-document-to-database (add-key-to-document k v))))
    (catch Exception e (debug/print-error-info e)))
  (timbre/spy :debug (apply str " at the end of 
 persist-session-data-to-database, our cpu and thread usage looks like 
this: " (debug/thread-top)))
  (. java.lang.Thread sleep 600000)
  (persist-session-data-to-database))

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to