Skip to content

Commit

Permalink
Add proccontrol/src/resp.C
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Apr 3, 2024
1 parent 8fc103f commit 1fe4c84
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 36 deletions.
45 changes: 29 additions & 16 deletions docs/proccontrol/developer/resp.h.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,35 @@
resp.h
######

.. cpp:type:: Resp* Resp_ptr
.. cpp:type:: RespItem<Dyninst::ProcControlAPI::stat64_ptr> StatResp_t
.. cpp:type:: RespItem<Dyninst::ProcControlAPI::int_eventAsyncFileRead> FileReadResp_t
.. cpp:type:: RespItem<Dyninst::ProcControlAPI::FileSet> FileSetResp_t
.. cpp:type:: RespItem<unsigned long> MemUsageResp_t
.. cpp:class:: resp_process : virtual public int_process

A second implementation of the response class. On async systems, it tracks command
messages we've sent to the OS, and associates them with the responses we receive
from the OS.

.. code:: cpp
Resp has several improvements over response:

#define Resp_ptr_NULL NULL
- Integrated support for multi-responses, where you get multiple responses from one message.
- Replacement of response's global lock with a per-process condition variable, which should
have significantly less contention
- Templated parameters to hold command specific data.

.. cpp:class:: resp_process : virtual public int_process
Over the long-term, it would be nice to completely replace response with Resp, but for the
moment Resp will just be used for new code.

.. cpp:function:: private void addResp(Resp_ptr resp, unsigned id_start, unsigned id_end)
.. cpp:function:: private void markRespPosted(Resp_ptr resp)
.. cpp:function:: private void rmResponse(Resp_ptr resp, bool lock_held = false)
.. cpp:function:: private void markRespDone(Resp_ptr resp)
.. cpp:member:: private std::map<int, Resp_ptr> active_resps
.. cpp:member:: private CondVar<Mutex<false>> active_resps_lock
.. cpp:function:: Resp_ptr recvResp(unsigned int id, bool &is_complete)
.. cpp:function:: resp_process(Dyninst::PID p, std::string e, std::vector<std::string> a, std::vector<std::string> envp, std::map<int,int> f)
.. cpp:function:: resp_process(Dyninst::PID p, std::string e, std::vector<std::string> a,\
std::vector<std::string> envp, std::map<int, int> f)
.. cpp:function:: resp_process(Dyninst::PID pid_, int_process *p)
.. cpp:function:: ~resp_process()
.. cpp:function:: void waitForEvent(Resp_ptr resp)


.. cpp:class:: Resp

.. cpp:member:: protected unsigned int id_start
Expand All @@ -44,6 +53,7 @@ resp.h
.. cpp:function:: void done()
.. cpp:function:: bool hadError() const


.. cpp:enum:: Resp::state

.. cpp:enumerator:: Setup
Expand All @@ -52,11 +62,14 @@ resp.h
.. cpp:enumerator:: Done
.. cpp:enumerator:: Error

.. cpp:class:: template<class T> RespItem : public Resp

.. cpp:member:: T *obj
.. cpp:type:: Resp* Resp_ptr
.. cpp:type:: RespItem<Dyninst::ProcControlAPI::stat64_ptr> StatResp_t
.. cpp:type:: RespItem<Dyninst::ProcControlAPI::int_eventAsyncFileRead> FileReadResp_t
.. cpp:type:: RespItem<Dyninst::ProcControlAPI::FileSet> FileSetResp_t
.. cpp:type:: RespItem<unsigned long> MemUsageResp_t


.. code:: cpp
.. cpp:function:: RespItem(T *obj_, resp_process *proc_)
.. cpp:function:: RespItem(T *obj_, resp_process *proc_, unsigned multi_size)
.. cpp:function:: virtual ~RespItem()
.. cpp:function:: T *get()
#define Resp_ptr_NULL NULL
20 changes: 0 additions & 20 deletions proccontrol/src/resp.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,6 @@
#include <map>
#include <string>
#include <vector>

/**
* The Resp class is a second implementation of the response
* class. On async systems, it tracks
* command messages we've sent to the OS, and associates them
* with the responses we receive from the OS.
*
* Resp has several improvements over response:
* - Integrated support for multi-responses, where you
* get multiple responses from one message.
* - Replacement of response's global lock with a
* per-process condition variable, which should have
* significantly less contention
* - Templated parameters to hold command specific data.
*
* Over the long-term, it would be nice to completely replace
* response with Resp, but for the moment Resp will just be used
* for new code.
**/

#include "int_process.h"

class Resp;
Expand Down

0 comments on commit 1fe4c84

Please sign in to comment.